| Summary: | Validation error needed for nested ElementCollection | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Karen Butzke <karenfbutzke> | ||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||
| Status: | REOPENED --- | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P2 | CC: | guy.pelletier, mathias.schaefer, tom.ware | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
This is not supported by spec, section 2.6. "An embeddable class (including an embeddable class within another embeddable class) contained within an element collection must not contain an element collection, nor may it contain a relationship to an entity other than a many-to-one or one-to-one relationship. The embeddable class must be on the owning side of such a relationship and the relationship must be mapped by a foreign key mapping. (See Section 2.9.)" When the feature was being developed, there were discussions surrounding this and we decided not to provide support above and beyond the spec in this case. I am reopening this as the exception you get with this use case is so difficult to decipher. We should be giving a validation error that the Embeddable cannot contain an ElementCollection Resetting target and priority. Current opinion is that this is a fringe case. I stumpled over this exception while testing the new nosql (mongodb) support coming with Eclipse Juno. In my opinion this is not an fringe case anymore - at least for the usage of nosql databases. This is now an ordinary use case and so this problem might become a real show stopper. Changing to an enhancement request. Please vote for it if it is important to you. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Created attachment 178424 [details] exception stack trace Given the following example attempt to generate DDL and you get the attached exception and the tables are not generated. Looks like this exception would happen just logging in and initializing descriptors. I am testing with 2.2.0 M2 @Entity public final class PropertyRecord { @EmbeddedId PropertyOwner owner; @AttributeOverrides({ @AttributeOverride(name="key.street", column=@Column(name="STREET")), @AttributeOverride(name="value.size", column=@Column(name="SQ_FEET")), @AttributeOverride(name="value.tax", column=@Column(name="TAX")),}) @ElementCollection Map<Address, PropertyInfo> parcels; } @Embeddable public class Address { protected String street; protected int city; @ElementCollection protected Collection<Zipcode> zipcode; } @Embeddable public class Zipcode { protected String zip; protected String plusFour; } @Embeddable public class PropertyInfo { Integer parcelNumber; Integer size; BigDecimal tax; } @Embeddable public class PropertyOwner { private String name; }