JayZee
JayZee

Reputation: 860

Hibernate: analyze "deleted entity passed to persist" on commit()

I have a complex workflow business call to refactor: this workflow retrieves, updates and delete some entities on the DB. In the end I try to delete an entity, and once I commit the transaction I get:

javax.persistence.EntityNotFoundException: deleted entity passed to persist:[com.my.Entity#<null>] 

I think there's another operation conflicting with this delete, but I cannot figure out which.

It there a way (logging some debug information in Hibernate), on the commit phase, to see the operations associated to each entity?

Is there a way to dump the inner state of the entity manager?

As this operation occurs only once the commit() is fired I cannot sort out where the conflict occurs.

Upvotes: 0

Views: 493

Answers (1)

Luca Basso Ricci
Luca Basso Ricci

Reputation: 18403

Enable log and sql trace in your hibernate.cfg.xml

<property name="show_sql">true</property>
<property name="format_sql">true</property>

for a fast solution.
If not enought configure your logger like described here.
Look here for parameters value substitution.

Upvotes: 1

Related Questions