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.  [ 2 posts ] 
Author Message
 Post subject: Problem in cascade update
PostPosted: Thu Mar 03, 2005 3:27 am 
Beginner
Beginner

Joined: Thu Feb 24, 2005 8:27 am
Posts: 21
Hibernate version:2.1.7
[b]Mapping documents:

<hibernate-mapping package="mypkg">

<class name="Tempuser" table="TempUser" >
<id name="userid" column="userID" type="java.lang.String" unsaved-value="any">
<generator class="assigned" />
</id>

<property name="password" column="password"
type="java.lang.String" />

<joined-subclass name="mypkg.Tempexaminee"
table="TempExaminee" >
<key column="userid"></key>
<property name="firstname" column="firstName"></property>
</joined-subclass>



<joined-subclass name="mypkg.Tempadmin" table="TempAdmin" >
<key column="userID" ></key>

<property name="rights" column="rights" ></property>
</joined-subclass>

</class>

</hibernate-mapping>


[b]Code between sessionFactory.openSession() and session.close():
Transaction ts= HibernateSessionFactory.currentSession().beginTransaction();
String userid="chaxmax";
Tempuser te=(Tempuser) HibernateSessionFactory.currentSession().load(Tempuser.class, userid ) ;// ("from Tempuser t where t.userid=\'chaxmax\'").get(0);
te.setUserid("maxchax");
HibernateSessionFactory.currentSession().update(te);
ts.commit();
HibernateSessionFactory.closeSession();
System.out.println("successfully ");

[b]Full stack trace of any exception that occurs:


net.sf.hibernate.HibernateException: identifier of an instance of mypkg.Tempexaminee altered from chaxmax to maxchax
at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2662)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2485)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2478)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2280)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at myclient.MyClient.main(MyClient.java:41)
Exception in thread "main"

Name and version of the database you are using:sql server

Plz help me out that how can i cascade update.


Top
 Profile  
 
 Post subject: Plz help me out
PostPosted: Fri Mar 04, 2005 5:19 am 
Beginner
Beginner

Joined: Thu Feb 24, 2005 8:27 am
Posts: 21
Plz if any one know this help me out . i got stuck in my project


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

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.