Beginner |
|
Joined: Thu May 26, 2005 12:31 pm Posts: 25
|
Hibernate version:2.1.8
Mapping documents: <hibernate-mapping package="com.sample.dao">
<class name="EMP" table="TBPEMP" >
<id name="EMP_ID" type="double" unsaved-value="any" column="EMP_ID" > <generator class="assigned"/> </id>
<property name="EMP_NAME" type="java.lang.String" column="EMP_NAME" not-null="true" length="20" /> </class> </hibernate-mapping>
Code between sessionFactory.openSession() and session.close(): HibernateUtil.createSession(); HibernateUtil.beginTransaction(); session= HibernateUtil.getSession(); EMP emp = (EMP)session.load(EMP.class,new Double(11471884)); System.out.println(pol.getPOL_NUM()); emp.setEMP_NAME("New Name"); HibernateUtil.commit();
Full stack trace of any exception that occurs:
Name and version of the database you are using: Oracle 9i
The generated SQL (show_sql=true):
First select statement for session.load...
then Update statement when doing commit.
I just loaded EMP object and modified obe field. Then just did commit WITHOUT doing session.save or update. Still its generated update statement and modifed data in DB. why it is happening like this? How to avoid this? Please help..
|
|