JPA, How can I find out what will be stored in the database?

I have a JPA object that has child collections through OneToMany relationships, and I set cascade = CascadeType.ALL, however, when I save the parent object, it does not save any changes made to the child collection (for example, adds or removes). I do not know why this is so.

It would be useful to know if there is a way to get information from JPA EntityManager, etc. about what will be saved at the end of the transaction.

Not sure how to do this? Debugging this is not possible.

+3
source share
1 answer

, SQL, . log4j.properties /conf, . , . , :

log4j.logger.org.hibernate=info
### log just the SQL
log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=debug

### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=info

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug
+5

Source: https://habr.com/ru/post/1779025/


All Articles