Hibernate generate POJOs with Equals

Posted by jschoen on Stack Overflow See other posts from Stack Overflow or by jschoen
Published on 2010-03-26T14:08:42Z Indexed on 2010/03/26 14:13 UTC
Read the original article Hit count: 320

We are using hibernate in a new project where we use the hibernate.reveng.xml to create our *.hbm.xml files and POJOs after that. We want to have equals methods in each of our POJOs. I found that you can use <meta attribute="use-in-equals">true</meta> in your hbm files to mark which properties to use in the equals. But this would mean editing alot of files, and then re-editing the files again in the future if/when we modify tables or columns in our DB.

So I was wondering if there is a way to place which properties to use in the equals method for each pojo(table) in the hibernate.reveng.xml file?

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about reverse-engineering