Hibernate Tips: How to automatically set an attribute before persisting it

Hibernate Tips: How to automatically set an attribute before persisting it

Hibernate Tips is a new series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question you like me to answer, please leave a comment below. Question: I want to initialize an entity attribute automatically before it gets persisted. How can I execute custom code…

Hibernate Tips: How to create a database setup script based on entity mappings

Hibernate Tips: How to create a database setup script based on entity mappings

Hibernate Tips is a series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question you like me to answer, please leave a comment below. Question: I want to use a database setup script instead of Hibernate’s schema generation. What’s the easiest way to create…