简体   繁体   English

休眠逆向工程标识列

[英]hibernate reverse engineering identity column

I have a legacy database at SQL Server 2008 and I would like to use Hibernate ORM. 我在SQL Server 2008上有一个旧数据库,我想使用Hibernate ORM。
So I tried reverse engineering by using jboss tools eclipse kepler. 因此,我尝试使用jboss工具eclipse kepler进行逆向工程。
But my problem is pojo class generation. 但是我的问题是pojo类的产生。

I have tables which are using integer auto-incremented columns in legacy databse. 我有一些表在遗留数据库中使用整数自动递增的列。
But my pojo classes are generated without having identity columns. 但是我的pojo类是在没有标识列的情况下生成的。
So according to this tutorial , I can make it correct to set identity columns. 因此,根据本教程 ,我可以正确设置身份列。

<primary-key><generator class="identity"/></primary-key>

But my question is do I always need to write that additional xml tag ? 但是我的问题是我是否总是需要编写该额外的xml标签?
What if I have 99 out of 100 tables are using integer auto-incremented colums in legacy database ? 如果我有100个表中的99个在遗留数据库中使用整数自动递增的列怎么办?
What if my development team need to update legacy database tables again, and generate pojo again? 如果我的开发团队需要再次更新旧数据库表并再次生成pojo怎么办?
Then it will be made many duplicate manual input again and again. 然后,将一次又一次地进行许多重复的手动输入。

Could anyone please give me any more better solution? 有人可以给我更多更好的解决方案吗?

in hibernate reverse engering configuration you can define the type transformtaions like : 在休眠反向复仇配置中,您可以定义类型转换,例如:

<hibernate-reverse-engineering>
<type-mapping>
 <sql-type jdbc-type="BIGINT" length='20' hibernate-type="Long" /> 
</type-mapping>
</hibernate-reverse-engineering>

Jboss Reference Link Jboss参考链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM