mercoledì 20 maggio 2009

Hibernate: generate toString() and equals() [ENG]

If you want Hibernate Tools to generate toString() and equals() methods picking some fields from .hbm.xml mapping files you may use these meta-tags:

<id name="id" type="long">
        <meta attribute="use-in-tostring">true</meta>
        <meta attribute="use-in-equals">true</meta>
        <column name="id" />
</id>
<property name="number" type="string" unique-key="UK_t_table1">
        <meta attribute="use-in-tostring">true</meta>
        <column name="number" length="5" />
</property>

Nessun commento: