Community
Participate
Working Groups
Resource: hr/src/com/pnx/hr/shared/model/JobHistory.java Location: line 32 this problems shows on the enclosing classes even though it works in hibernate
Created attachment 197350 [details] attached entities
It is difficult to determine the cause of the problem using the provided attachment. There are too many dependencies missing. I have tried to create a pared down project, but am not sure that the resultant code will still work in Hibernate. Can you attach the simplest project that illustrates the problem without any external dependencies?
actually i have additional info which may shed light on it, this happens if i define the id member as a generic in AbstractPersistable class, onky extends it with EntityPersitable<Integer> instead of defining it directly in PersistableEntity
Created attachment 197977 [details] test project Created usable project test case from previous attachment.
The problem boils down to being able to resolve a type binding from within the scope of a subclass. public class Foo<T> { public T bar; } public class SubFoo<Long> {} When we analyze the type of bar, we currently look at the "erasure" of its type binding, which in this case will be Object. And in this use case, it's not enough. SubFoo imposes a stricter type binding on bar, and we must be able to resolve that type binding from within the context of SubFoo. Our model definitely doesn't have the sophistication to handle this currently, and I doubt that it's something we can handle in a maintenance release.
(the body of type SubFoo should actually read: public class SubFoo extends Foo<Long> {} )
(In reply to comment #6) > (the body of type SubFoo should actually read: > > public class SubFoo extends Foo<Long> {} > > ) the larger question is whether JPA specs support this kind of usage at all, or if they define it. if they do not, then dali should provide an error stating so , if on other hand that behavior is undefined, or is defined but dali is unable to support it, then it should provide a warning about it, at least untill it gets fixed or defined to prevent user from searching endlessly, as the original error doesn't give away much about it's true cause.
Moving JPA specific bugs to new JPA component in bugzilla.
Targeting to Juno release.
We should consider this for 3.2 M7.
(In reply to comment #10) > We should consider this for 3.2 M7. I think we'll find the fix too large in scope at this point, but we can always spend time determining what the eventual fix will be.
Created attachment 214836 [details] test project showing original Dali validation error I've attached a pared down test project that shows the original error that the user reported. It seems to work fine in EclipseLink so I would assume it will work in Hibernate. The incorrect Dali validation error is: 'The type of the ID mapped by the relationship 'employee' does not agree with the primary key class of the target entity.' I was confused since this was originally listed in the subject line and is no longer.
Committed new API for 3.3 M1 to address this issue.