@Entity
@Table(name=”news_inf”)
public class News
{
// 消息类的标识属性
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private String id;
// 消息标题
private String title;
// 消息内容
private String content;
// id的setter和getter方法
如果想要是uuid等方式可那么如下设置:
@Entity
@Table(name=”news_two”)
public class Newstow
{
// 消息类的标识属性
@Id @Column(name=”news_id”)
// 使用@GenericGenerator定义主键生成器。
// 该主键生成器名为fk_hilo,使用Hibernate的hilo策略,
@GenericGenerator(name=”fk_hilo” , strategy=”uuid”)
// 指定使用fk_hilo主键生成器
@GeneratedValue(generator=”fk_hilo”)
private String id;
// 消息标题
private String title;
// 消息内容
private String content;
// id的setter和getter方法