How to get Hibernate Tools to generate POJOs with toString,equals and hashcode?

余生长醉 提交于 2019-12-04 11:51:42

This assumes the default Hibernate Tools/JBoss Tools

You define it with each column you want to have a toString() or equals() call. Provide it as a meta property

<table schema="public" name="someName" class="com.stackovervlow">
        <primary-key>

        </primary-key>
        <column name="xx" property="id" type="long">
            <meta attribute="use-in-tostring">true</meta>
            <meta attribute="scope-set">private</meta>
        </column>
        <column name="yy">
            <meta attribute="use-in-tostring">true</meta>
            <meta attribute="use-in-equals">true</meta>
        </column>   
    </table>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!