Hibernate
文章平均质量分 71
iteye_15162
这个作者很懒,什么都没留下…
展开
-
hibernate-annotations——@Column
今天看了下Hibernate的@Column注解 @Column( name="columnName"; 1 boolean unique() default false; 2 boolean nullable() default true; 3 boolean inser...原创 2010-08-24 23:05:12 · 141 阅读 · 0 评论 -
hibernate-annotations——@OneToOne
1.OneToOne共享主键 import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToOne; imp...原创 2010-08-26 23:08:36 · 81 阅读 · 0 评论 -
数据的插入和更新时间
最近项目要求某些表记录数据的插入时间和更新时间: import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import j...2010-10-25 20:33:45 · 152 阅读 · 0 评论 -
关于Hibernate中的FetchType.EAGER
1.先定义两个model:Question和Answer,每个Question对应多个Answer; Question.java package lan.study.hibernate.model; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity...原创 2011-01-22 14:07:04 · 232 阅读 · 0 评论 -
Hibernate——关于save和persist
@Test public void testSave(){ DomesticCat cat = new DomesticCat(); cat.setId(101); cat.setName("Hello kitty"); cat.setSex('M'); cat.setBirthday(new...原创 2011-04-13 15:11:37 · 115 阅读 · 0 评论 -
Hibernate annotations ——@ManyToMany
1.此处以用户和角色作为实体进行多对多映射,用@JoinTable指定中间表的名称 User.java @Entity public class User { private Integer id; private String name; private Set<Role> roles; @Id @GeneratedVa...原创 2012-11-27 13:11:38 · 98 阅读 · 0 评论