Hi,
Hibernate version:3.1
I am using
oracle-ds.xml and getting the datasource and establishing a connection with the Connection object from the datasource of oracle.
My Oracle-ds.xml is : -
Code:
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>
jdbc:oracle:thin:@localhost:1521:testdna
</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>test</user-name>
<password>test</password>
<min-pool-size>0</min-pool-size>
</local-tx-datasource>
</datasources>
I have removed the connection properties from hibernate.cfg.xml and my hibernate.cfg.xml is : -
Code:
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Drop and re-create the database schema on startup
<property name="hbm2ddl.auto">update</property> -->
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="hibernate.cglib.use_reflection_optimizer">false</property>
<!-- mapping files -->
Now, when I run my application I am experiencing a strang behaviour in hibernate I get the following exception :
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.app.Product#3481].
I am doing batchupdate in my application where I am deleting some records in the child table and updating the record in the parent table.
I am experiencing this behaviour when I use the Datasource provided by oracle.
If I use hibernate.cfg.xml and specify the connection parameters in it, then my execution is smooth and successful.
Am I missing anything in my configuration. Can somebody please suggest
what is the problem.
I have even tried using cascade="evict,merge,save-update". As suggested in the chapter 10.11 of hibernate reference. But Still I am not able to get thru the problem.
Thanks In advance for the solution.
Thanks,
Manjith A.