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.
|
|