Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325641 - Regression in element collection join column validation
Summary: Regression in element collection join column validation
Status: RESOLVED DUPLICATE of bug 294267
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-17 14:17 EDT by Karen Butzke CLA
Modified: 2022-06-09 10:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Butzke CLA 2010-09-17 14:17:18 EDT
I have tested this with the 2.2.0v20100819-r8063 build and in the 2.2.0.v20100908-r8149 build. This model works fine in the 8/19 build, but in the 9/08 build EclipseLink gets the following exception while processing the JPA metadata. This should be a valid model. From looking at the code history it looks related to Guy's changes on 9/3 for bug 317286. Also, the exception message is missing the word "not"

@Entity
public class Bar {
    @Id
    private int id;
	
    private int discriminator;
	
    @ElementCollection    
    @CollectionTable(name="BLAH",
	joinColumns={
	@JoinColumn(name="id"), 
	@JoinColumn(name="owningEntity", referencedColumnName="discriminator")
    }
    )
    private Map<String, String> foo;
}


Exception Description: The reference column name [discriminator] mapped on the element [field foo] does correspond to a valid field on the mapping reference.
	at org.eclipse.persistence.exceptions.ValidationException.invalidReferenceColumnName(ValidationException.java:1790)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor.getReferencedField(MetadataAccessor.java:419)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ElementCollectionAccessor.processCollectionTable(ElementCollectionAccessor.java:745)
Comment 1 Guy Pelletier CLA 2010-09-17 15:16:28 EDT
For this model to work correctly right now, you need to set the case insensitivity flag, that is, the property: eclipselink.jpa.uppercase-column-names to true.

That property currently defaults to false, meaning for the attribute

  private int discriminator;

it defaults the field name to 'DISCRIMINATOR' whereas the referenced column name refers to 'discriminator' and these are therefore treated as two different fields.

Once bug 294267 is fixed, we will be case insensitive by default and this model will work as is.

*** This bug has been marked as a duplicate of bug 294267 ***
Comment 2 Guy Pelletier CLA 2010-09-17 15:22:10 EDT
Also, I did add the 'not' to the exception string, thanks for catching that.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:04:36 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink