-->
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.  [ 3 posts ] 
Author Message
 Post subject: Un update provoque un deadlock lors d'un select !?
PostPosted: Wed May 18, 2005 3:42 am 
Beginner
Beginner

Joined: Wed Mar 30, 2005 5:41 am
Posts: 40
Hibernate version:
3.0.2

Salut,

Je suis en train d'implémenter une fonctionnalité de recherche sur une application J2EE et je constate quelque chose d'étrange : l'appel de ma méthode findAll (cf ci-dessous) provoque l'exécution de requêtes update...

Je suppose que ça pose des problèmes de performance (même si je n'ai rien constaté de gênant), mais ce qui est vraiment gênant, c'est que ça provoque parfois une LockAcquisitionException (cf ci-dessous).

Comment se fait-il que des update soient exécutés lors d'un select et comment régler ce problème ?

Merci d'avance
Lilian

Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>
   <subclass
      name="bab.admin.model.persistent.Worker"
      discriminator-value="worker"
      extends="bab.admin.model.persistent.IParty" >
      
      <!--<property
         name="workedHours"
         formula="( SELECT (HOUR(p.endDate)-HOUR(p.startDate)) FROM t_period p where p.periodId = periodId )" />-->
      
      <!--<property name="workedJobs"
         formula="( SELECT COUNT(mission.serviceWorkerId) FROM t_serviceworker mission
                WHERE mission.partyId = partyId )" />-->
               
        <set
         name="specialities"
         table="t_workerspeciality"
         lazy="true"
         cascade="save-update"
         sort="unsorted" >

         <key column="partyId"></key>

         <many-to-many
            class="bab.admin.model.persistent.Speciality"
            column="specialityId"
            outer-join="auto" />

      </set>
      
      <set
         name="jobsWorker"
         inverse="true" >
      
         <key column="partyId" />
         
         <one-to-many
            class="bab.admin.model.persistent.JobWorker" />
      
      </set>
      
      <join table="t_avs">
      
         <key column="partyId" />
         
         <component name="avs">

            <property name="cotise" column="cotiseYN" type="java.lang.Boolean"/>
            <property name="number" column="avsNumber" />
            <property name="requestDate" />
            <property name="expeditionDate" />
            <property name="receptionDate" />
            
         </component>
      </join>
      
      <join table="t_person">
      
         <key column="partyId" />
         
         <property name="sex" />
         <property name="title" />
         <property name="maritalStatus" column="maritalStatusCode" />
         <property name="birthdate" />
         <property name="accountInfo" />
         
         <component
            name="fullname"
            class="bab.admin.model.persistent.Fullname" >
            <property name="firstname" />
            <property name="lastname" />
         </component>
      </join>
      
      <join table="t_worker">
      
         <key column="partyId" />

         <property name="enabled" type="java.lang.Boolean" update="true"
            insert="true" access="property" column="enabledYN" not-null="false"
            unique="false" />
   
         <property name="critic" type="java.lang.String" update="true"
            insert="true" access="property" column="critic" not-null="false"
            unique="false" />
   
         <property name="compliment" type="java.lang.String"
            update="true" insert="true" access="property" column="compliment"
            not-null="false" unique="false" />
   
         <property name="motivationCode" type="java.lang.String"
            update="true" insert="true" access="property" column="motivationCode"
            not-null="true" unique="false" />
   
         <property name="motivationShortCode" type="java.lang.String"
            update="true" insert="true" access="property"
            column="motivationShortCode" not-null="true" unique="false" />
   
         <property name="affiliationDate" type="java.util.Date"
            update="true" insert="true" access="property"
            column="affiliationDate" not-null="true" unique="false" />
   
         <property name="lastReactivationDate" type="java.util.Date"
            update="true" insert="true" access="property"
            column="lastReactivationDate" not-null="false" unique="false" />
   
         <property name="workPermitCode" type="java.lang.String"
            update="true" insert="true" access="property" column="workPermitCode"
            not-null="true" unique="false" />
   
         <property name="authorizationExpirationDate"
            type="java.util.Date" update="true" insert="true" access="property"
            column="authorizationExpirationDate" not-null="false" unique="false" />
   
         <property name="source" type="java.lang.Boolean" update="true"
            insert="true" access="property" column="sourceYN" not-null="false"
            unique="false" />
            
         <many-to-one
            name="activity"
            column="activityId"  />
      </join>
      
      <join table="t_workerDisponibility" >
         <key column="partyId" />
         
         <component
            name="disponibilities"
            class="bab.admin.model.persistent.Disponibility" >
         
            <property name="mondayMorning" column="mondayMorningYN" />
            <property name="mondayAfternoon" column="mondayAfternoonYN" />
            <property name="mondayNight" column="mondayNightYN" />
            <property name="tuesdayMorning" column="tuesdayMorningYN" />
            <property name="tuesdayAfternoon" column="tuesdayAfternoonYN" />
            <property name="tuesdayNight" column="tuesdayNightYN" />
            <property name="wednesdayMorning" column="wednesdayMorningYN" />
            <property name="wednesdayAfternoon" column="wednesdayAfternoonYN" />
            <property name="wednesdayNight" column="wednesdayNightYN" />
            <property name="thursdayMorning" column="thursdayMorningYN" />
            <property name="thursdayAfternoon" column="thursdayAfternoonYN" />
            <property name="thursdayNight" column="thursdayNightYN" />
            <property name="fridayMorning" column="fridayMorningYN" />
            <property name="fridayAfternoon" column="fridayAfternoonYN" />
            <property name="fridayNight" column="fridayNightYN" />
            <property name="saturdayMorning" column="saturdayMorningYN" />
            <property name="saturdayAfternoon" column="saturdayAfternoonYN" />
            <property name="saturdayNight" column="saturdayNightYN" />
            <property name="sundayMorning" column="sundayMorningYN" />
            <property name="sundayAfternoon" column="sundayAfternoonYN" />
            <property name="sundayNight" column="sundayNightYN" />
            
            <property name="february" column="februaryYN" />
            <property name="paques" column="paquesYN" />
            <property name="summer" column="summerYN" />
            <property name="autumn" column="autumnYN" />
            <property name="noel" column="noelYN" />
            <property name="jeunegenevois" column="jeunegenevoisYN" />
            <property name="ascension" column="ascensionYN" />
            <property name="pentecote" column="pentecoteYN" />
         </component>
      </join>
   </subclass>

</hibernate-mapping>


DefaultDAO.findAll:
Code:
   public Collection findAll( Class clazz ) throws InfrastructureException
   {
      try
      {
         Session session = HibernateUtil.getSession();
         Criteria crit = session.createCriteria( clazz );
         return crit.list();
      }
      catch ( HibernateException ex )
      {
         throw new InfrastructureException( ex );
      }
   }


Full stack trace of any exception that occurs:
Code:
17:54:08,905  WARN JDBCExceptionReporter:71 - SQL Error: 1205, SQLState: 41000
17:54:08,905 ERROR JDBCExceptionReporter:72 - Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"
17:54:08,905 ERROR AbstractFlushingEventListener:277 - Could not synchronize database state with session
org.hibernate.exception.LockAcquisitionException: could not update: [bab.admin.model.persistent.Worker#126]
   at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:77)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1990)
   at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
   at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
   at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:48)
   at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:659)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1248)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
   at bab.admin.model.dao.DefaultDAO.findAll(DefaultDAO.java:90)
   at bab.admin.model.dao.WorkersDAO.findAll(WorkersDAO.java:44)
   at bab.admin.web.action.workers.SearchAction.execute(SearchAction.java:60)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
   at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
   at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
   at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:316)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at bab.admin.web.filter.HibernateFilter.doFilter(HibernateFilter.java:51)
   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.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:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1772)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1619)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
   ... 52 more
17:54:08,915  WARN RequestProcessor:509 - Unhandled Exception thrown: class bab.admin.model.exceptions.InfrastructureException
17:54:08,915 ERROR [action]:704 - "Servlet.service()" pour la servlet action a lancé une exception
bab.admin.model.exceptions.InfrastructureException: org.hibernate.exception.LockAcquisitionException: could not update: [bab.admin.model.persistent.Worker#126]
   at bab.admin.model.dao.DefaultDAO.findAll(DefaultDAO.java:94)
   at bab.admin.model.dao.WorkersDAO.findAll(WorkersDAO.java:44)
   at bab.admin.web.action.workers.SearchAction.execute(SearchAction.java:60)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
   at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
   at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
   at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:316)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at bab.admin.web.filter.HibernateFilter.doFilter(HibernateFilter.java:51)
   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.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:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.exception.LockAcquisitionException: could not update: [bab.admin.model.persistent.Worker#126]
   at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:77)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1990)
   at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
   at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
   at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:48)
   at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:659)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1248)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
   at bab.admin.model.dao.DefaultDAO.findAll(DefaultDAO.java:90)
   ... 40 more
Caused by: java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1772)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1619)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
   ... 52 more
17:54:08,925  INFO HibernateUtil:158 - Closing Session of this thread. (0 sessions ouvertes
17:54:08,925 ERROR [action]:253 - "Servlet.service()" pour la servlet action a généré une exception
bab.admin.model.exceptions.InfrastructureException: org.hibernate.exception.LockAcquisitionException: could not update: [bab.admin.model.persistent.Worker#126]
   at bab.admin.model.dao.DefaultDAO.findAll(DefaultDAO.java:94)
   at bab.admin.model.dao.WorkersDAO.findAll(WorkersDAO.java:44)
   at bab.admin.web.action.workers.SearchAction.execute(SearchAction.java:60)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
   at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
   at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
   at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:316)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at bab.admin.web.filter.HibernateFilter.doFilter(HibernateFilter.java:51)
   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.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:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.exception.LockAcquisitionException: could not update: [bab.admin.model.persistent.Worker#126]
   at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:77)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1990)
   at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
   at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
   at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:48)
   at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:659)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1248)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
   at bab.admin.model.dao.DefaultDAO.findAll(DefaultDAO.java:90)
   ... 40 more
Caused by: java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1772)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1619)
   at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
   ... 52 more


Name and version of the database you are using:
MySQL 4.1

The generated SQL (show_sql=true):
Hibernate: select city0_.cityId as cityId, city0_.cityName as cityName1_, city0_.cityNPA as cityNPA1_, city0_.cityCountry as cityCoun4_1_ from t_city city0_ where city0_.cityNPA<>'0000'
17:53:08,859 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select this_.quartierId as quartierId0_, this_.cityId as cityId2_0_, this_.quartierName as quartier3_2_0_ from t_quartier this_
17:53:08,869 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select this_.specialityId as speciali1_0_, this_.value as value5_0_, this_.oldValue as oldValue5_0_, ( SELECT count(*) FROM t_workerspeciality ws WHERE ws.specialityId = this_.specialityId ) as formula1_0_ from t_speciality this_
17:53:08,889 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select activity0_.activityId as activityId, activity0_.value as value0_, activity0_.oldValue as oldValue0_, activity0_.shortValue as shortValue0_, ( SELECT count(*) FROM t_worker w WHERE w.activityId = activity0_.activityId ) as formula0_ from t_activity activity0_ where activity0_.value<>'INCONNUE'
17:53:08,899 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select this_.partyId as partyId0_, this_.comment as comment4_0_, this_1_.cotiseYN as cotiseYN20_0_, this_1_.avsNumber as avsNumber20_0_, this_1_.requestDate as requestD4_20_0_, this_1_.expeditionDate as expediti5_20_0_, this_1_.receptionDate as receptio6_20_0_, this_2_.sex as sex6_0_, this_2_.title as title6_0_, this_2_.maritalStatusCode as maritalS4_6_0_, this_2_.birthdate as birthdate6_0_, this_2_.accountInfo as accountI8_6_0_, this_2_.firstname as firstname6_0_, this_2_.lastname as lastname6_0_, this_3_.enabledYN as enabledYN21_0_, this_3_.critic as critic21_0_, this_3_.compliment as compliment21_0_, this_3_.motivationCode as motivati5_21_0_, this_3_.motivationShortCode as motivati6_21_0_, this_3_.affiliationDate as affiliat7_21_0_, this_3_.lastReactivationDate as lastReac8_21_0_, this_3_.workPermitCode as workPerm9_21_0_, this_3_.authorizationExpirationDate as authori10_21_0_, this_3_.sourceYN as sourceYN21_0_, this_3_.activityId as activityId21_0_, this_4_.mondayMorningYN as mondayMo2_22_0_, this_4_.mondayAfternoonYN as mondayAf3_22_0_, this_4_.mondayNightYN as mondayNi4_22_0_, this_4_.tuesdayMorningYN as tuesdayM5_22_0_, this_4_.tuesdayAfternoonYN as tuesdayA6_22_0_, this_4_.tuesdayNightYN as tuesdayN7_22_0_, this_4_.wednesdayMorningYN as wednesda8_22_0_, this_4_.wednesdayAfternoonYN as wednesda9_22_0_, this_4_.wednesdayNightYN as wednesd10_22_0_, this_4_.thursdayMorningYN as thursda11_22_0_, this_4_.thursdayAfternoonYN as thursda12_22_0_, this_4_.thursdayNightYN as thursda13_22_0_, this_4_.fridayMorningYN as fridayM14_22_0_, this_4_.fridayAfternoonYN as fridayA15_22_0_, this_4_.fridayNightYN as fridayN16_22_0_, this_4_.saturdayMorningYN as saturda17_22_0_, this_4_.saturdayAfternoonYN as saturda18_22_0_, this_4_.saturdayNightYN as saturda19_22_0_, this_4_.sundayMorningYN as sundayM20_22_0_, this_4_.sundayAfternoonYN as sundayA21_22_0_, this_4_.sundayNightYN as sundayN22_22_0_, this_4_.februaryYN as februaryYN22_0_, this_4_.paquesYN as paquesYN22_0_, this_4_.summerYN as summerYN22_0_, this_4_.autumnYN as autumnYN22_0_, this_4_.noelYN as noelYN22_0_, this_4_.jeunegenevoisYN as jeunege28_22_0_, this_4_.ascensionYN as ascensi29_22_0_, this_4_.pentecoteYN as penteco30_22_0_ from t_party this_ inner join t_avs this_1_ on this_.partyId=this_1_.partyId inner join t_person this_2_ on this_.partyId=this_2_.partyId inner join t_worker this_3_ on this_.partyId=this_3_.partyId inner join t_workerDisponibility this_4_ on this_.partyId=this_4_.partyId where this_.partyType='worker'

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?
Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?

Hibernate: select jobsworker0_.partyId as partyId__, jobsworker0_.serviceWorkerId as serviceW1___, jobsworker0_.serviceWorkerId as serviceW1_0_, jobsworker0_.serviceId as serviceId13_0_, jobsworker0_.salaryRuleId as salaryRu3_13_0_, jobsworker0_.partyId as partyId13_0_, jobsworker0_.clientEvaluationId as clientEv5_13_0_, jobsworker0_.workerEvaluationId as workerEv6_13_0_, jobsworker0_.payDate as payDate13_0_, jobsworker0_.contractDate as contract8_13_0_, jobsworker0_.sourceYN as sourceYN13_0_, jobsworker0_.sourceRate as sourceRate13_0_ from t_serviceworker jobsworker0_ where jobsworker0_.partyId=?
17:53:10,381 INFO HibernateUtil:158 - Closing Session of this thread. (0 sessions ouvertes
17:53:16,770 DEBUG HibernateUtil:121 - HibernateUtil.getSession
17:53:16,770 INFO HibernateUtil:127 - Opening new Session for this thread. (1 sessions ouvertes)

Hibernate: select this_.partyId as partyId0_, this_.comment as comment4_0_, this_1_.cotiseYN as cotiseYN20_0_, this_1_.avsNumber as avsNumber20_0_, this_1_.requestDate as requestD4_20_0_, this_1_.expeditionDate as expediti5_20_0_, this_1_.receptionDate as receptio6_20_0_, this_2_.sex as sex6_0_, this_2_.title as title6_0_, this_2_.maritalStatusCode as maritalS4_6_0_, this_2_.birthdate as birthdate6_0_, this_2_.accountInfo as accountI8_6_0_, this_2_.firstname as firstname6_0_, this_2_.lastname as lastname6_0_, this_3_.enabledYN as enabledYN21_0_, this_3_.critic as critic21_0_, this_3_.compliment as compliment21_0_, this_3_.motivationCode as motivati5_21_0_, this_3_.motivationShortCode as motivati6_21_0_, this_3_.affiliationDate as affiliat7_21_0_, this_3_.lastReactivationDate as lastReac8_21_0_, this_3_.workPermitCode as workPerm9_21_0_, this_3_.authorizationExpirationDate as authori10_21_0_, this_3_.sourceYN as sourceYN21_0_, this_3_.activityId as activityId21_0_, this_4_.mondayMorningYN as mondayMo2_22_0_, this_4_.mondayAfternoonYN as mondayAf3_22_0_, this_4_.mondayNightYN as mondayNi4_22_0_, this_4_.tuesdayMorningYN as tuesdayM5_22_0_, this_4_.tuesdayAfternoonYN as tuesdayA6_22_0_, this_4_.tuesdayNightYN as tuesdayN7_22_0_, this_4_.wednesdayMorningYN as wednesda8_22_0_, this_4_.wednesdayAfternoonYN as wednesda9_22_0_, this_4_.wednesdayNightYN as wednesd10_22_0_, this_4_.thursdayMorningYN as thursda11_22_0_, this_4_.thursdayAfternoonYN as thursda12_22_0_, this_4_.thursdayNightYN as thursda13_22_0_, this_4_.fridayMorningYN as fridayM14_22_0_, this_4_.fridayAfternoonYN as fridayA15_22_0_, this_4_.fridayNightYN as fridayN16_22_0_, this_4_.saturdayMorningYN as saturda17_22_0_, this_4_.saturdayAfternoonYN as saturda18_22_0_, this_4_.saturdayNightYN as saturda19_22_0_, this_4_.sundayMorningYN as sundayM20_22_0_, this_4_.sundayAfternoonYN as sundayA21_22_0_, this_4_.sundayNightYN as sundayN22_22_0_, this_4_.februaryYN as februaryYN22_0_, this_4_.paquesYN as paquesYN22_0_, this_4_.summerYN as summerYN22_0_, this_4_.autumnYN as autumnYN22_0_, this_4_.noelYN as noelYN22_0_, this_4_.jeunegenevoisYN as jeunege28_22_0_, this_4_.ascensionYN as ascensi29_22_0_, this_4_.pentecoteYN as penteco30_22_0_ from t_party this_ inner join t_avs this_1_ on this_.partyId=this_1_.partyId inner join t_person this_2_ on this_.partyId=this_2_.partyId inner join t_worker this_3_ on this_.partyId=this_3_.partyId inner join t_workerDisponibility this_4_ on this_.partyId=this_4_.partyId where this_.partyType='worker' and this_3_.enabledYN=? and this_2_.birthdate between ? and ?
17:53:17,111 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select city0_.cityId as cityId, city0_.cityName as cityName1_, city0_.cityNPA as cityNPA1_, city0_.cityCountry as cityCoun4_1_ from t_city city0_ where city0_.cityNPA<>'0000'
17:53:17,321 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select this_.quartierId as quartierId0_, this_.cityId as cityId2_0_, this_.quartierName as quartier3_2_0_ from t_quartier this_
17:53:17,451 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select this_.specialityId as speciali1_0_, this_.value as value5_0_, this_.oldValue as oldValue5_0_, ( SELECT count(*) FROM t_workerspeciality ws WHERE ws.specialityId = this_.specialityId ) as formula1_0_ from t_speciality this_
17:53:17,581 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: select activity0_.activityId as activityId, activity0_.value as value0_, activity0_.oldValue as oldValue0_, activity0_.shortValue as shortValue0_, ( SELECT count(*) FROM t_worker w WHERE w.activityId = activity0_.activityId ) as formula0_ from t_activity activity0_ where activity0_.value<>'INCONNUE'
17:53:17,661 DEBUG HibernateUtil:121 - HibernateUtil.getSession

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?
Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?

Hibernate: update t_avs set cotiseYN=?, avsNumber=?, requestDate=?, expeditionDate=?, receptionDate=? where partyId=?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 18, 2005 5:45 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
Comment se fait-il que des update soient exécutés lors d'un select et comment régler ce problème ?

pas normal, vérifie ton code (peut etre un traitement particulier dans get/set de tes propriétés).

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 18, 2005 7:27 am 
Beginner
Beginner

Joined: Wed Mar 30, 2005 5:41 am
Posts: 40
anthony wrote:
Quote:
Comment se fait-il que des update soient exécutés lors d'un select et comment régler ce problème ?

pas normal, vérifie ton code (peut etre un traitement particulier dans get/set de tes propriétés).


Merci pour ta réponse,

effectivement j'avais eu un problème avec l'AVS... Il s'agit d'un objet dépendant ("join table" +"component") qui doit toujours exister pour un Worker. Donc dans la déclaration de la propriété, je fais ça :
Code:
private AVS avs = new AVS();


Et effectivement, dans la base, j'ai autant de ligne dans t_avs que dans t_worker. Malheureusement, je recevais des NullPointerException en essayant d'accéder aux propriétés de l'AVS et je me suis rendu compte que Hibernate appelait mon setter en passant null. Alors j'ai fais ça :
Code:
   public void setAvs( AVS avs )
   {
      if ( avs == null )   //TODO à voir, hibernate initialise à null...
         return;
      this.avs = avs;
   }


Donc suite à ton message, je trouve aussi que c'est normal que des updates soient générés. En revanche, je trouve moins normal que hibernate initialise l'avs à null. Mais je pense que c'est parceque si tous les champs sont null, l'objet lui-même est considéré comme null.

Mais alors quelle est la bonne manière de procéder pour que Hibernate initialise bien la propriété avec un objet correspondant à la ligne dans t_avs ? Je pourrais ajouter un champs bidon avec une valeur quelconque afin que tous les champs ne soient pas null mais ça ne me paraît pas satisfaisant.

Merci d'avance
Lilian


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