-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: persist a subclass
PostPosted: Mon Jan 09, 2012 12:12 pm 
Newbie

Joined: Mon Jan 09, 2012 11:49 am
Posts: 3
hi everyone,
I've a problem with hibernate and I'm going crazy. I searched the solution on google but i didn't find that, so I'd like to ask you

I'm using the last version of Hibernate with jpa annotation persist my application

I've a class Traveller and a subclass Driver which are mapped on the same table "Traveller" with a discriminator "traveller_type" (which is "dummy" for the superclass and "driver" for the subclass).
Now, I've to change the state of the superclass to the subclass: a traveller which is persisted must become a driver and I've to persist that

How can I do it?
I tried in a lot of ways, the last one was:
- i create a driver object with the traveller datas
- i add the specified datas
- i try to "saveOrUpdate" the driver
but hibernate gives me an exception: "a different object with the same identifier value was already associated with the session"

I tried to merge the object ( "session.merge(driver)" ) but i receive another exception: "org.hibernate.AssertionFailure: null identifier"


can you help me please?

thanks

Alberto

P.S. i forgot: i use postgresql 9.1 as db


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.