Hibernate 简单的annotation
2012-04-14 11:07
246 查看
package com.itmyhome.model; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; @Entity @Table(name="_teacher") public class Teacher { private int id; private String name; private String address; private Date birthday; /* * ID * 其他默认全部映射 默认为@Basic */ @Id public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic public String getName() { return name; } public void setName(String name) { this.name = name; } /* * 如果不想让其字段映射到数据表中 可使用Transient */ @Transient public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } /* * 设置时间的类型 有DATE,TIME,TIMESTAMP */ @Temporal(TemporalType.DATE) public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } }
相关文章推荐
- Hibernate 3.2.5 annotation介绍及其简单例子
- hibernate Annotation简单学习
- spring2.5 + hibernate3.2 标注(annotation)开发的简单示例
- Hibernate中,基于Annotation的简单树形结构的实现
- Hibernate 简单的annotation
- Hibernate 简单的annotation
- 1.3 hibernate annotation环境搭建及简单的例子
- hibernate多对多annotation的简单实用
- 注解(Annotation)源码解析--简单实现(Hibernate,EJB,JPA)
- java annotation简单模拟hibernate
- Hibernate的XML和annotation两种方式简单例子
- 完整的简单的Annotation版本的hibernate
- Hibernate Annotation简单实现
- spring + hibernate + annotation 简单整合
- hibernate简单事例,注意事项,保存,更新,删除,session,Query,Criteria查询_Hql与Criteria查询的补充知识
- Hibernate 零配置Annotation注解
- 最简单的Hibernate入门简介
- hibernate3.0+ejb3 annotaion配置实战+spring1.21 annotation事务控制
- hibernate简单程序,实现从页面对数据库的增删改查(主从表关联)
- Spring中使用Hibernate3的Annotation