is not guaranteed to be unique over time, it is obtained from Java's System#identityHashCode().
The current implementation, when running against a large enough database, is likely to trigger INSERT exceptions. For example, we saw this with a log of 1145 rows:
`java.sql.BatchUpdateException: Violation of PRIMARY KEY constraint 'SessionLogEntry_PK'. Cannot insert duplicate key in object 'isissessionlogger.SessionLogEntry'. The duplicate key value is (842471748).
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:543)
at org.datanucleus.api.jdo.JDOPersistenceManager.flush(JDOPersistenceManager.java:2070)
at org.apache.isis.core.runtime.system.persistence.PersistenceSession.executeCommands(PersistenceSession.java:1255)
at org.apache.isis.core.runtime.system.persistence.PersistenceSession.execute(PersistenceSession.java:1247)
at org.apache.isis.core.runtime.system.transaction.IsisTransaction.doFlush(IsisTransaction.java:378)
at org.apache.isis.core.runtime.system.transaction.IsisTransaction.flush(IsisTransaction.java:332)
at org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.flushTransaction(IsisTransactionManager.java:268)
at org.apache.isis.core.runtime.services.persistsession.PersistenceSessionServiceInternalDefault.flush(PersistenceSessionServiceInternalDefault.java:154)
at org.apache.isis.core.metamodel.services.xactn.TransactionServiceInternalDefault.flushTransaction(TransactionServiceInternalDefault.java:36)
at org.apache.isis.core.metamodel.services.repository.RepositoryServiceInternalDefault.persistAndFlush(RepositoryServiceInternalDefault.java:103)
at org.isisaddons.module.sessionlogger.dom.SessionLogEntryRepository.create(SessionLogEntryRepository.java:99)
at org.isisaddons.module.sessionlogger.dom.SessionLoggingServiceDefault.log(SessionLoggingServiceDefault.java:36)
at org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis$1.run(AuthenticatedWebSessionForIsis.java:179)
at org.apache.isis.core.runtime.system.session.IsisSessionFactory$1.call(IsisSessionFactory.java:316)
at org.apache.isis.core.runtime.system.session.IsisSessionFactory$1.call(IsisSessionFactory.java:313)
at org.apache.isis.core.runtime.system.session.IsisSessionFactory.doInSession(IsisSessionFactory.java:347)
... 70 more`
from https://github.com/isisaddons-legacy/isis-module-sessionlogger/issues/9
The
sessionId
passed toSessionLoggingService
:is not guaranteed to be unique over time, it is obtained from Java's System#identityHashCode().
The current implementation, when running against a large enough database, is likely to trigger INSERT exceptions. For example, we saw this with a log of 1145 rows: