12:15:02,718 WARN StaleObjectStateException:27 - An operation failed due to stale data
net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for uk.police.kent.licensing.shared.PersonalLicenceHolder instance with identifier: 221
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:514)
at net.sf.hibernate.persister.NormalizedEntityPersister.update(NormalizedEntityPersister.java:667)
at net.sf.hibernate.persister.NormalizedEntityPersister.update(NormalizedEntityPersister.java:642)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2260)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at uk.police.kent.licensing.shared.data.LicenceHolderDAO.saveNewLicenceHolder(LicenceHolderDAO.java:91)
at uk.police.kent.licensing.web.LicenceHolderAction.saveEditPH(LicenceHolderAction.java:130)
at uk.police.kent.licensing.web.LicenceHolderAction.save(LicenceHolderAction.java:45)
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:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
12:15:02,734 ERROR SessionImpl:2399 - Could not synchronize database state with session
05/02/25 12:15:06 uk.police.kent.licensing.shared.data.DataAccessException: Error loading or saving data...Root cause......
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for uk.police.kent.licensing.shared.PersonalLicenceHolder instance with identifier: 221
05/02/25 12:15:06 at uk.police.kent.licensing.shared.data.LicenceHolderDAO.saveNewLicenceHolder(LicenceHolderDAO.java:107)
05/02/25 12:15:06 at uk.police.kent.licensing.web.LicenceHolderAction.saveEditPH(LicenceHolderAction.java:130)
05/02/25 12:15:06 at uk.police.kent.licensing.web.LicenceHolderAction.save(LicenceHolderAction.java:45)
05/02/25 12:15:06 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
05/02/25 12:15:06 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
05/02/25 12:15:06 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
05/02/25 12:15:06 at java.lang.reflect.Method.invoke(Method.java:324)
05/02/25 12:15:06 at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
05/02/25 12:15:06 at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
05/02/25 12:15:06 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
05/02/25 12:15:06 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
05/02/25 12:15:06 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
05/02/25 12:15:06 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
05/02/25 12:15:06 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
05/02/25 12:15:06 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
05/02/25 12:15:06 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
05/02/25 12:15:06 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
05/02/25 12:15:06 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
05/02/25 12:15:06 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
05/02/25 12:15:06 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
05/02/25 12:15:06 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
05/02/25 12:15:06 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
05/02/25 12:15:06 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
05/02/25 12:15:06 at java.lang.Thread.run(Thread.java:534)
12:24:48,984 DEBUG SQL:229 - select LICENCE_SEQ.nextval from dual
05/02/25 12:24:48 Hibernate: select LICENCE_SEQ.nextval from dual
12:24:49,000 DEBUG SQL:229 - insert into LICENCE (STATUS, DATE_APPLICATION, LICENCE_ID) values (?, ?, ?)
05/02/25 12:24:49 Hibernate: insert into LICENCE (STATUS, DATE_APPLICATION, LICENCE_ID) values (?, ?, ?)
12:24:49,000 DEBUG SQL:229 - insert into PERSONAL_LICENCE (PERSON_ID, LICENCE_ID) values (?, ?)
05/02/25 12:24:49 Hibernate: insert into PERSONAL_LICENCE (PERSON_ID, LICENCE_ID) values (?, ?)
12:24:49,000 DEBUG StringType:41 - binding null to parameter: 1
12:24:49,015 DEBUG DateType:41 - binding null to parameter: 2
12:24:49,015 DEBUG LongType:46 - binding '265' to parameter: 3
12:24:49,015 DEBUG LongType:46 - binding '221' to parameter: 1
12:24:49,015 DEBUG LongType:46 - binding '265' to parameter: 2
12:24:49,031 DEBUG SQL:229 - update PERSON set FIRST_NAME=?, LAST_NAME=?, DATE_OF_BIRTH=?, HOME_TELEPHONE=?, MOBILE_TELEPHONE=?, EMAIL=?, NATIONAL_INSURANCE=?, TITLE=?, ADDRESS_ID=? where PERSON_ID=?
05/02/25 12:24:49 Hibernate: update PERSON set FIRST_NAME=?, LAST_NAME=?, DATE_OF_BIRTH=?, HOME_TELEPHONE=?, MOBILE_TELEPHONE=?, EMAIL=?, NATIONAL_INSURANCE=?, TITLE=?, ADDRESS_ID=? where PERSON_ID=?
12:24:49,031 DEBUG SQL:229 - update PERSONAL_LICENCEHOLDER set STATUS=?, DATE_EFFECTIVE_ON=? where PERSON_ID=?
05/02/25 12:24:49 Hibernate: update PERSONAL_LICENCEHOLDER set STATUS=?, DATE_EFFECTIVE_ON=? where PERSON_ID=?
12:24:49,031 DEBUG StringType:46 - binding 'Juan' to parameter: 1
12:24:49,046 DEBUG StringType:46 - binding 'Kerr' to parameter: 2
12:24:49,046 DEBUG DateType:46 - binding '04 September 1965' to parameter: 3
12:24:49,046 DEBUG StringType:46 - binding '012345 65987' to parameter: 4
12:24:49,046 DEBUG StringType:46 - binding '07895422123' to parameter: 5
12:24:49,046 DEBUG StringType:46 - binding
'ju@n.kerr.com' to parameter: 6
12:24:49,046 DEBUG StringType:46 - binding '' to parameter: 7
12:24:49,046 DEBUG StringType:46 - binding 'Mr' to parameter: 8
12:24:49,046 DEBUG LongType:41 - binding null to parameter: 9
12:24:49,046 DEBUG LongType:46 - binding '221' to parameter: 10
12:24:49,046 DEBUG StringType:46 - binding 'Application' to parameter: 1
12:24:49,062 DEBUG DateType:46 - binding '21 February 2005' to parameter: 2
12:24:49,093 DEBUG LongType:46 - binding '221' to parameter: 3
My issue is this - obviously what I am doing isn't working so have been trying to figure this out for a couple of days now but need clarification as to whether this is possible.
If I already have persisted a object of type PremisesLicenceHolder (that is a sub class of Person and therefore has a Person record also persisted with same ID), and then want to save a different object PersonalLicenceHolder (which is also a subclass of Person) that is also the same person as the first one - i.e. the PersonalLicenceHOlder id should be the same as the Person (and PremisesLicenceHolder) - can this be done??? If so, can anyone suggest any pointers from the above stack trace/ mapping files/ sql etc. ???