-->
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: BatchUpdate fails With Oracle DataSource + NonUniqueObjectEx
PostPosted: Wed May 10, 2006 3:03 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
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.


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.