我使用休眠工具生成我的实体时出现了一种奇怪的行为。我需要“java名称”来尊重一些约定。所以我配置了 de reveng.xml 是这样的:
<hibernate-reverse-engineering>
<schema-selection match-schema="SCHEMA" match-table="PRE_.*" />
<table-filter match-name="PRE_.*" package="com.my.ent"/>
<table name="PRE_MY_TABLE" schema="SCHEMA" class="MyTable">
<column name="C_ID" property="id" />
<column name="C_COD" property="cod" />
</table>
<table name="PRE_MY_TABLE_2" schema="SCHEMA" class="MyTable2">
<column name="C_ID" property="id" />
<column name="C_COD" property="cod" />
</table>
....
<table name="PRE_MY_TABLE_N" schema="SCHEMA" class="MyTableN">
<column name="C_ID" property="id" />
<column name="C_COD" property="cod" />
</table>
</hibernate-reverse-engineering>
我所期望的是生成的代码(实体 1 到 N)将位于工具 conf 中设置的文件夹中,其中文件夹结构位于 (com.my.ent) 中,并尊重 reveng 文件中设置的名称。取而代之的是,我得到的代码位于正确的文件夹结构中,但名称与数据库中的名称完全相同。
我不明白,这是一个简单的程序,我无法让它正常工作。
任何帮助将不胜感激。
提前致谢!