Reputation: 1903
I am selecting data from a table which is call pHistory, this table does not have any relationShip with CenterLog entity, however, I am still getting hibernate error complain that null id in CenterLog entity.
The log is as follow:
org.hibernate.AssertionFailure: null id in com.audit.entity.CenterLog entry (don't flush the Session after an exception occurs)
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:78) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:187) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:143) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1589) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:328) ~[hibernate-core-3.3.1.GA.jar:3.3.1.GA]
As my understanding, uniqueResult is not doing any save event, but not sure I am still hitting this.
Upvotes: 1
Views: 90
Reputation: 14656
The error message says (don't flush the Session after an exception occurs)
: there was another exception earlier and it the cause of the problem.
You need to find that other exception and fix it.
Upvotes: 1