Home Spring data JPA with H2 database not returning non-merged data
Reply: 0

Spring data JPA with H2 database not returning non-merged data

user801
1#
user801 Published in May 22, 2018, 9:22 pm

I have an entity with created_date (updateable = false) and updated_date fields. I have @PreUpdate method where I change the updated_date value only (not change created_date), and @PrePersist method which sets new created_date and updated_date values. On Persist the created_date and updated_date are rightly persisted and the returned entity has the correct values. When I pass in the entity to merge, it rightly updates the updated_date (@PreUpdate), and I don't pass the created_date in input. In the database the right updated_date value is updated and created_date value is not changed rightly. But the returned entity has the created_date value set to null. Any Ideas why? Shouldn't the merged entity return the full entity loaded from the database?

Thanks

Sam

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308074 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO