
hibernate
Mr__fang
无
展开
-
hibernate中one-to-one两种配置方式
public class Person { private int id; private String name; private IdCard idCard; public Person() { } public Person(int id, String name, IdCard idCard) { this.id = id; this.name = name;原创 2013-02-19 17:44:36 · 23415 阅读 · 1 评论 -
hibernate映射many-to-many
多对多(teacher - student)在操作和性能方面都不太理想,所以多对多的映射使用较少,实际使用中最好转换成一对多的对象模型;Hibernate会为我们创建中间关联表,转换成两个一对多。teacher private int id; private String name; private Set student;student priva原创 2013-02-20 10:55:19 · 869 阅读 · 0 评论 -
基于按annotation的hibernate主键生成策略
原文地址:http://xiaogui9317170.iteye.com/blog/283526这里讨论代理主键,业务主键(比如说复合键等)这里不讨论。 一、JPA通用策略生成器 通过annotation来映射hibernate实体的,基于annotation的hibernate主键标识为@Id, 其生成规则由@GeneratedValue设定的.这里的@id和@Gener转载 2014-11-26 13:23:00 · 646 阅读 · 0 评论