This content has been marked as final.
Show 3 replies
-
1. Re: @GeneratedValue in mappedSuperclass Problem
jc7442 Nov 17, 2006 3:48 PM (in response to hoeft)Use persist instead of merge. In your case, it looks to be a new instance not a detached one.
I use MappedSuperClass in my app and it works fine. -
2. Re: @GeneratedValue in mappedSuperclass Problem
hoeft Nov 18, 2006 4:33 AM (in response to hoeft)Thank you for your answer, I'll try it.
But: I defined the getId and setId in the TestEntity class in my current code. The id is generated if I call the merge method. And: If I look into the documentation I see that the merge method should work properly for my purposes. But I'll try your suggestion. Maybe it' s hibernate bug and the stuff works only with persist in MappedSupperclasses :-(.
I use JBOSS 4.0.5GA.
Best regards
Meinert -
3. Re: @GeneratedValue in mappedSuperclass Problem
fhh Nov 19, 2006 10:33 AM (in response to hoeft)Hi!
I had the same problem. I do not have a solution but a work-around is to overwrite the getId()-method and put the @Id- and @Generated-annotation there:@Entity public static class TestEntity extends EntityWithIntId implements Serializable @Id @GeneratedValue getId() { return super.getId(); } }
Regards
fhh