@Controller控制器
@Service
@Conponent 组件
@Repository Dao访问层
@Entity 实体
@Table 实体mapping表
@Column 属性mapping列 ----> 不需要Mapping的时候用@Transient
@Id mapping主键属性,可以将Entity中的某个属性标识为标识符(identifier)。可通过应用自身创建,也可以由Hibernate生成。
@Genarated value 标识符的生产策略。
*AUTO 可以是一下三种任意一种类型,取决于底层数据库的不同
*TABLE 使用table保存id值
*IDENTITY identity column 主键由数据库自动生成(主要是自动增长型,像MySql、SQL Server)
*SEQUENCE sequence (Oracle主键不能自增长,使用Sequence)
@Id
@GeneratedValue(strategy = GenerationType.IDENTITy)
Public Integer getId() {… …}
@Id
@GeneratedValue(generator = "system-uuid")[该属性名自定义]
@GenericGenerator(name = " system-uuid ", strategy = "uuid")
[name可自定义,但是strategy属性必须是Hibernate中有效的主键策略]
@Column (name = "user_id")
private Integer userId;
@Id
@GeneratedValue(generator = "hilo")
@GenericGenerator(name = "hilo", strategy = "hilo")
@Column (name = "user_id")
private Integer userId;
@mappedBy用法
mappedBy用于OneToMany、ManyToMany、OneToOne,指由另一方维护两者的关系。
注解分为两类,分别是Logical mapping和Physical mapping,通过Logical mapping可用描述对象模型,类之间的关系等等,而Physical mapping注释则描述了物理的schema,表,列,索引等等。
分享到:
相关推荐
5.5.2. 使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent ...
5.5.2. 使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent ...
5.5.2. 使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent ...
5.5.2. 使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent ...
5.5.2. 使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent collections) ...
5.4.2. 使用 JDK 5.0 的注解(Annotation) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent collections) 6.2. 集合映射( Collection mappings ) 6.2.1. 集合外键(Collection foreign keys) 6.2.2. 集合...
使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent collections) ...
Hibernate注释大全收藏 声明实体Bean @Entity public class Flight implements Serializable { Long id; @Id public Long getId() { return id; } public void setId(Long id) { this.id = id; } } @Entity ...
6.4.2. 使用 JDK 5.0 的注解(Annotation) 7. 集合类(Collections)映射 7.1. 持久化集合类(Persistent collections) 7.2. 集合映射( Collection mappings ) 7.2.1. 集合外键(Collection foreign keys) 7.2.2. ...
5.5.2. 使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent ...
6.4.2. 使用 JDK 5.0 的注解(Annotation) 7. 集合类(Collections)映射 7.1. 持久化集合类(Persistent collections) 7.2. 集合映射( Collection mappings ) 7.2.1. 集合外键(Collection foreign keys) 7.2.2. ...
5.4.2. 使用 JDK 5.0 的注解(Annotation) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent collections) 6.2. 集合映射( Collection mappings ) 6.2.1. 集合外键(Collection foreign keys) 6.2.2. 集合...
使用 JDK 5.0 的注解(Annotation) 7. 集合类(Collections)映射 7.1. 持久化集合类(Persistent collections) 7.2. 集合映射( Collection mappings ) 7.2.1. 集合外键(Collection foreign keys) 7.2.2. 集合...
5.5.2. 使用 JDK 5.0 的注解(Annotation) 5.6. 数据库生成属性(Generated Properties) 5.7. 辅助数据库对象(Auxiliary Database Objects) 6. 集合类(Collections)映射 6.1. 持久化集合类(Persistent collections) ...
You'll master key features including annotation-based syntax, load-time weaver, annotation-based crosscutting, and Spring-AspectJ integration. Building on familiar technologies such as JDBC, ...
本资源是一个最简单的一个ssh框架实例,包含完整的代码(dao层有annotation和xml两种实现方式修改applicationContext.xml和hibernate.cfg.xml相应位置就可以切换),数据库ssh.sql文件,和所有的jar包,运行于eclips...
PART 2 DEVELOPING PORTLETS USING SPRING AND HIBERNATE Getting started with Spring Portlet MVC Annotation-driven development with Spring Integrating portlets with databases PART 3 ADVANCED PORTLET ...
8.5. Boolean composition for constraint composition 9. Annotation Processor 9.1. 前提条件 9.2. 特性 9.3. 配置项 9.4. 使用标注处理器 9.4.1. 命令行编译 9.4.2. IDE集成 9.5. 已知问题 10. 进一步阅读
Exporting a lazily initialized bean (which implements SelfNaming and is annotated with ManagedResource annotation) gives IllegalStateException [SPR-17592] #22124 MockHttpServletRequest changes Accept-...
* Learn simple annotation-driven dependency injection, scoping and AOP, and why it all works the way it works. * Be the first to familiarize yourself with concepts that are likely to be included in ...