Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341835

Summary: An embeddable with single attribute used for embedded-id case should be handled
Product: [WebTools] Dali JPA Tools Reporter: Nan Li <nan.n.li>
Component: JPAAssignee: Neil Hauge <neil.hauge>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: brian.vosburgh, neil.hauge
Version: unspecified   
Target Milestone: Future   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 325645    
Bug Blocks:    

Description Nan Li CLA 2011-04-04 16:04:33 EDT
Build Identifier: I-3.3.0-20110324075937

With our current implentation, the default name of join/referenced join column is null if embedded-id mapping is used; we should handle the case when the embedded id class (the embeddable) only has one attribute. The corresponding column name of the single attribute should be used as the default.

Reproducible: Always
Comment 1 Neil Hauge CLA 2011-05-03 18:20:52 EDT
Seems this could result in invalid error messages and as such is a candidate for RC1.
Comment 2 Neil Hauge CLA 2011-05-11 16:51:54 EDT
This has a fairly simple workaround (specify join columns), so moving out of RC's and into maintenance.
Comment 3 Karen Butzke CLA 2011-06-08 08:40:59 EDT
I am curious how important of a case this is. The point of using an EmbeddedId is for composite primary keys. The spec does not support any defaults for the JoinColumns if there is a reference that has a composite primary key. EclipseLink *does* support defaults for this case (bug 325645).

So, I guess I am wondering where in the spec or the JPA book is there an example where the EmbeddedId has only one attribute in the Embeddable and do we really need to spend the time to support that case? And if we do, is this appropriate for a maintenance release? I am thinking it might make more sense to do it along with bug 325645
Comment 4 Brian Vosburgh CLA 2011-06-08 12:40:43 EDT
When Nan and I were digging into what it would take to fix bug 325645, how we should handle an EmbeddedId/Embeddable with a single field presented itself as an obvious issue. If I remember correctly, possibly defaulting an Embeddable with a single column would be trivial alongside the changes necessary for bug 325645. So, I agree this bug should be fixed alongside the bug 325645, not now for a maintenance release.

As to "What is the "right" thing to do with a single field EmbeddedId/Embeddable?", I don't know. But I don't think the spec disallows it. We could do whatever EclipseLink does, I guess.
Comment 5 Nan Li CLA 2011-06-08 14:36:53 EDT
I had a thought before that this case worked like a single primary key so we might handle it with the same way as we handle regular primary key, but it is more a special case of composite primary key so I agree that it makes more sense to fix it along with bug 325645.
Comment 6 Neil Hauge CLA 2011-07-01 16:25:06 EDT
Moving JPA specific bugs to new JPA component in bugzilla.
Comment 7 Karen Butzke CLA 2011-11-01 10:47:46 EDT
It seems we have decided to fix this along with bug 325645 and that is targeted to 3.2, targeting this to 3.2 as well
Comment 8 Karen Butzke CLA 2012-03-22 17:37:14 EDT
Same comment as before, targeting to 3.3 along with bug 235645