如何自动使用Hibernate增加非主ID列? [英] How to auto increment a non primary id column using Hibernate?

查看:136
本文介绍了如何自动使用Hibernate增加非主ID列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直主键自动递增,通过使用自动增加选项,在我的表。
我说,使用Hibernate。

I have kept auto increment for primary key, by using auto increment option in my Table. And I stated that using hibernate.

但现在我想自动增量列这是不使用Hibernate注解的主键列。
请帮忙。先谢谢了。

But now I want to auto increment a column which is not a primary key column using Hibernate Annotation. Please help. Thanks in advance.

推荐答案

使用以下标注在特定领域

Use the following annotation over the specific field

@GeneratedType

@GeneratedType

私人诠释non_Primary_field

private int non_Primary_field

这篇关于如何自动使用Hibernate增加非主ID列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆