我當前使用休眠的設置使用hibernate.reveng.xml
文件來生成各種hbm.xml
文件。然後使用hbm2java
變成POJO。我們花了一些時間設計我們的模式,在表格和列上放置一些相當不錯的描述。當使用hbm2jhbmxml
生成文件時,我可以將這些描述放入hbm.xml
文件中。如何在hbm2java中創建註釋創建POJO?
所以我得到類似這樣:
<class name="test.Person" table="PERSONS">
<comment>The comment about the PERSONS table.</comment>
<property name="firstName" type="string">
<column name="FIRST_NAME" length="100" not-null="true">
<comment>The first name of this person.</comment>
</column>
</property>
<property name="middleInitial" type="string">
<column name="MIDDLE_INITIAL" length="1">
<comment>The middle initial of this person.</comment>
</column>
</property>
<property name="lastName" type="string">
<column name="LAST_NAME" length="100">
<comment>The last name of this person.</comment>
</column>
</property>
</class>
那我怎麼告訴hbm2java
在創建Java文件拉,並把這些意見?
我已閱讀this有關編輯freemarker模板以更改生成代碼的方式。我承認這個概念,但並不是要詳細說明除了事前和事後條件的例子之外,你還可以用它做什麼。
@Pascal看起來像我在找什麼。一旦我能夠真正嘗試它,我會回來接受它。謝謝您的幫助。 – 2010-04-01 17:54:51