@注解配置实体类映射
实体一般有id,普通属性,集合属性等,分别对应数据库中的主键,普通列,外键。@注解配置中,实体类@entity注解,用@table指定对应的数据表,@id配置主键。用@column配置普通属性,用@onetomany、@manytoone、@onetoone、@manytomany配置实体间的关系等。
//...导入一系列包<省略>@entity@table(name = “tb_cat”)public class cat{@id@generatedvalue(string = generationtype.auto)private integer id;@column(name = “name”)private string name;@temporal(temporaltype.timestamp)@column(name = “createdate”)private timestamp createdate; //….getter、setter方法省略}