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.  [ 4 posts ] 
Author Message
 Post subject: Tables remain locked after unsucessfull commit
PostPosted: Tue Nov 17, 2009 6:40 pm 
Newbie

Joined: Tue Nov 17, 2009 6:16 pm
Posts: 2
Hello guys.

Well, Im currently facing this problem.

I want to persist two instances of the same class. The table related to the class has a Unique Key Constraint. When the two instances I want to persist have the same data (i.e., they violate the UK constraint) normally i would expect and exception and a rollback. Everything nominal until here, BUT, the problem is that apparently the hibernate session and transaction is never finalized.

I can notice it after checking active locks in the database.

After the transaction.commit(), the tables get locked, then it goes to the rollback and session closing, but the table locks never get released. To release table locks I must terminate JBoss.



Code:
=================  Delegate.java ========================

protected int saveFile() throws Exception {
      
      
      int resp = 0;

      HibernateFunctions functions = new HibernateFunctions();
      Transaction transaction = null;
      Session session = null;

      
      try {
         session = functions.getSession();
         transaction = session.beginTransaction();

         // The code here creates two instances with the same data (violating the UK)
         // and saves them using session.save(obj).
         // The data is only composed of primitive values.
          ...

         transaction.commit();  // Obviously, it throws an exception
      }
      catch (HibernateException e) {
         // so the control comes here. The exact exception is in the stack trace
         transaction.rollback(); // nothing strange here. I've surrounded this with a try catch block but no exception is thrown
         throw e;
      }
      
      finally {
         functions.closeSession();
      }

      return resp;
      
   }





Code:
================== HibernateFunctions.java ============

import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;

public class HibernateFunctions {
   protected Session session = null;

   protected SessionFactory factory = null;
   
   public Session getSession() throws Exception
   {
      if (this.session != null)
      {
         if (!this.session.isOpen() || !this.session.isConnected())
         {
            this.session = null;
         }
      }
      
      if (this.session == null)
      {
         InitialContext ctx = new InitialContext();
         factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
         this.session = factory.openSession();
      }
      
      return this.session;
   }
   
   protected StatelessSession getStatelessSession()
   {
      InitialContext ctx;
      try
      {
         ctx = new InitialContext();
         SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
         return factory.openStatelessSession();
      }
      catch (NamingException e)
      {
         e.printStackTrace();
      }
      
      return null;
   }
   
   public void setSession(Session session)
   {
      this.session = session;
   }
   
   public void closeSession()
   {
      try
      {                  
         if (this.session != null && session.isOpen())
         {
            if (session.isDirty())
               session.flush();
            
            session.clear();
            session.close();                        
         }
         
         
         
         /*
         if (this.factory != null)
         {
            this.factory.close();
         }
         */
      
         this.session = null;
         
         //this.factory = null;
      }
      catch (Exception ex)
      {
         ex.printStackTrace();
      }
   }

}




So, after executing the code (invoked by JSF/RichFaces), i get the following trace

Code:
10:56:02,359 WARN  [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
10:56:02,359 ERROR [JDBCExceptionReporter] ORA-00001: restricción única (CONSOLIDATION_UK) violada

10:56:02,359 WARN  [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
10:56:02,359 ERROR [JDBCExceptionReporter] ORA-00001: restricción única (CONSOLIDATION_UK) violada

10:56:02,359 ERROR [AbstractFlushingEventListener]    
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
   at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
   at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
   at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
   at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
   at org.jboss.tm.TxManager.commit(TxManager.java:240)
   at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)
   at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:146)
   at com.example.myapp.admin.delegates.company.AbstractHelper.saveFile(AbstractHelper.java:138)
   at com.example.myapp.admin.delegates.company.CompanyBusinessDelegate.uploadInformation(CompanyBusinessDelegate.java:141)
   at com.example.myapp.admin.beans.company.LoadInformationBean.aceptar(LoadInformationBean.java:208)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.sun.el.parser.AstValue.invoke(Unknown Source)
   at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
   at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
   at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
   at javax.faces.component.UICommand.broadcast(UICommand.java:332)
   at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
   at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
   at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
   at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at com.example.myapp.admin.faces.FileUploadFilter.doFilter(FileUploadFilter.java:70)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at com.example.myapp.admin.faces.SecurityFilter.doFilter(SecurityFilter.java:66)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.BatchUpdateException: ORA-00001: restricción única (CONSOLIDATION_UK) violada

   at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:602)
   at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9350)
   at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210)
   at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
   ... 62 more
10:56:02,406 ERROR [JTATransaction] JTA commit failed
org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=C0026335/14, BranchQual=, localId=14] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update)
   at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
   at org.jboss.tm.TxManager.commit(TxManager.java:240)
   at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)
   at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:146)
   at com.example.myapp.admin.delegates.company.AbstractHelper.saveFile(AbstractHelper.java:138)
   at com.example.myapp.admin.delegates.company.CompanyBusinessDelegate.uploadInformation(CompanyBusinessDelegate.java:141)
   at com.example.myapp.admin.beans.company.LoadInformationBean.aceptar(LoadInformationBean.java:208)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.sun.el.parser.AstValue.invoke(Unknown Source)
   at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
   at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
   at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
   at javax.faces.component.UICommand.broadcast(UICommand.java:332)
   at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
   at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
   at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
   at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at com.example.myapp.admin.faces.FileUploadFilter.doFilter(FileUploadFilter.java:70)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at com.example.myapp.admin.faces.SecurityFilter.doFilter(SecurityFilter.java:66)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
   at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
   at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
   at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
   at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
   ... 52 more
Caused by: java.sql.BatchUpdateException: ORA-00001: restricción única (CONSOLIDATION_UK) violada

   at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:602)
   at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9350)
   at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210)
   at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
   ... 62 more




The real problem is that the tables involved remain locked after the code execution, so the system becomes unusable after it.


Any help very appreciated :)
Thank you.


Top
 Profile  
 
 Post subject: Re: Tables remain locked after unsucessfull commit
PostPosted: Wed Nov 18, 2009 6:46 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Did you try saving and flushing without your HibernateFunction class. Try doing a direct save and flush. Also check if factory.getCurrentSession() will make a difference instead of factory.openSession().

_________________
Sukirtha


Top
 Profile  
 
 Post subject: Re: Tables remain locked after unsucessfull commit
PostPosted: Wed Nov 18, 2009 10:56 am 
Newbie

Joined: Tue Nov 17, 2009 6:16 pm
Posts: 2
Thank you Sukirtha for your reply.

I've done the test you proposed and some more (They're not JUnit tests, but i will use the PASS and FAIL notation). These are the results:


TEST using factory.getCurrentSession() instead of factory.openSession(): FAIL

Result: factory.getCurrentSession() returns null. The next tests use always factory.openSession()




TEST Creating One object: PASS

Code:

protected int saveFile() throws Exception {
      
      
      int resp = 0;

      HibernateFunctions functions = new HibernateFunctions();
      Transaction transaction = null;
      Session session = null;

      
      try {
         session = functions.getSession();
         transaction = session.beginTransaction();

         MyObj obj = new MyObj();
         obj.setMyField("my_value");
         
         session.save(obj);

         transaction.commit();
      }
      catch (HibernateException e) {
         transaction.rollback();
         throw e;
      }
      
      finally {
         functions.closeSession();

      }

      return resp;
      
   }






TEST Creating two objects: FAIL

Code:

protected int saveFile() throws Exception {
      
      
      int resp = 0;

      HibernateFunctions functions = new HibernateFunctions();
      Transaction transaction = null;
      Session session = null;

      
      try {
         session = functions.getSession();
         transaction = session.beginTransaction();

         MyObj obj1 = new MyObj();
         obj1.setMyField("my_value");
         

         MyObj obj2 = new MyObj();
         obj2.setMyField("my_value"); // the UK is violated since both
                   //objects have the same value for myField
         

         session.save(obj1);
         session.save(obj2);

         transaction.commit();
      }
      catch (HibernateException e) {
         transaction.rollback();
         throw e;
      }
      
      finally {
         functions.closeSession();

      }

      return resp;
      
   }


It obviously throws an ERROR [JDBCExceptionReporter] ORA-00001: unique constraint (CONSOLIDATION_UK) violated. The problem is that the tables remain locked in the database after this.

So, following Sukirtha suggestion, I've not used the HibernateFunctions class. Rather, i've obtained the factory and the session directly.





TEST Creating one object, obtaining session directly: PASS

Code:

protected int saveFile() throws Exception {
      
      
      int resp = 0;


      InitialContext ctx = new InitialContext();
      SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
      Session session = null;

      
      
      Transaction transaction = null;
      
      
      try {
         session = factory.openSession();
         transaction = session.beginTransaction();

         MyObj obj1 = new MyObj();
         obj1.setMyField("my_value");
         


         session.save(obj1);

         transaction.commit();
      }
      catch (HibernateException e) {
         transaction.rollback();
         throw e;
      }
      
      finally {
         functions.closeSession();
         session.close();

      }

      return resp;
      
   }


Result: Object is correctly inserted in the database and no table becomes locked. :)




TEST Creating two objects, obtaining session directly: FAIL



Code:

protected int saveFile() throws Exception {
      
      
      int resp = 0;


      InitialContext ctx = new InitialContext();
      SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
      Session session = null;

      
      
      Transaction transaction = null;
      
      
      try {
         session = factory.openSession();
         transaction = session.beginTransaction();

         MyObj obj1 = new MyObj();
         obj1.setMyField("my_value");
         


         MyObj obj2 = new MyObj();
         obj2.setMyField("my_value"); // the UK is violated since both
                   //objects have the same value for myField
         

         session.save(obj1);
         session.save(obj2);

         transaction.commit();
      }
      catch (HibernateException e) {
         transaction.rollback();
         throw e;
      }
      
      finally {
         functions.closeSession();
         session.close();

      }

      return resp;
      
   }

Result: Exception is thrown, and correctly catched by the catch block. But even after the transaction.rollback() and session.close(), tables remain locked.



TEST Creating one object, obtaining session directly, executing code twice: PASS

The first time the code is executed, the row is correctly inserted in the database.
The second time the code is executed, an exception is thrown, the transaction is correctly rolled back and no tables remain locked.

Observations
The lock (deadlock?) is ocurring when two records violate the Unique Key in the same transaction. When the UK is violated in another transaction, it works as expected.


So, am I doing something wrong here? What else should I try? What can I do to get rid of those eternal table locks?

Thank you. Your help is very appreciated.

Braiam.


Top
 Profile  
 
 Post subject: Re: Tables remain locked after unsucessfull commit
PostPosted: Thu Nov 19, 2009 2:48 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Braiam,
Hmmm...
But I still don't understand why would you set the same key twice within a single transaction. Ideally we set the primary key value through a hibernaet generator, however, it works only for numbers. Looks like you have got a string Primary key. Table lock problem sounds like a bug in hibrenate to me. But I am not sure. You could probably report in JIRA.
However, I suggest you to use generator for generating primary key values. If you use generator for populating your primary key value, hibernate will make sure you don't run into a UK violation while inserting records. Hope that helps.

_________________
Sukirtha


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.