@Id
@GenericGenerator(name="hibernate-uuid", strategy="uuid")
@GeneratedValue(generator="hibernate-uuid")
我只知道上面的代码可以利用"uuid"来配置一个String类型的字增长型的主键
但int型的用哪个配置?
还有,如果数据库表用column名与entity类中的属性名不同,又该如何配置
--下面这个URL怎么都打不开,想查下注释配置的用法都没法查,大家平时都是如何查这个配置用法的?
http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html
--XML当然也可以配置,现在问的是注释配置
诚谢!
@GenericGenerator(name="hibernate-uuid", strategy="uuid")
@GeneratedValue(generator="hibernate-uuid")
我只知道上面的代码可以利用"uuid"来配置一个String类型的字增长型的主键
但int型的用哪个配置?
还有,如果数据库表用column名与entity类中的属性名不同,又该如何配置
--下面这个URL怎么都打不开,想查下注释配置的用法都没法查,大家平时都是如何查这个配置用法的?
http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html
--XML当然也可以配置,现在问的是注释配置
诚谢!
解决方案 »
- 学习struts应该有个什么基础才能更好的学习
- 我为什么不能把从数据库读出来的字符串赋值给String的变量String str=rs.getString("name");
- 折腾了两天,那位大哥帮我看看是什么错啊?
- 直接访问action页面出错
- 讨论,你的项目中账号和密码在数据库中是加密存储的么?
- 面试被问到MVC和Java 2 Model或 Struts的差别?
- 没有这个包,到哪去下?
- EJB-QL语句的like表达式问题
- 关于idea的ssm和maven的搭建想法
- 不在方法签名中加入throw Exception, 那么方法还能抛出异常吗
- struts2中Action里一个类型为int的属性接收参数时发生奇怪问题。
- 这样的代码要进行重构吗?
@GeneratedValue(strategy = GenerationType.IDENTITY)
@column(name = "数据ID名称")
@GeneratedValue(strategy = GenerationType.IDENTITY)//可以用increment,或者seqence(oracle),identity(mysql,ms sql)
Hibernate Community Documentation里没有详细的解释啊。
@column(name = "数据库中对应字段的名称")
@GeneratedValue(strategy = GenerationType.IDENTITY)