Why are lifecycle listeners in Hibernate Serializable?

The Hibernate interfaces that you implement to provide event listeners, for example: org.hibernate.event.PostInsertEventListener;all extend Serializable.

However, nothing explains why your listeners should be serializable. We introduced a DAO with a database connection for some time, and it hasn’t worked yet, however I’m worried that there may be a case where Hibernate will transfer the listener via a serialized link and therefore lose the database connection.

So the question is: why should sleep mode listeners be serializable?

+5
source share
1 answer

, , , .

, , - .

.

DAO ( ).

DAO, DAO . DAO null, null DAO DAOFactory.

+2

All Articles