统一定义ID的基类

package com.inc.exam.entity;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
* @author 王晓磊
*
* 统一定义ID的基类
*
*/
@MappedSuperclass
public class IdEntity {

private Long id;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

}

你可能感兴趣的:(id)