UUIDEntity

package com.broadwave.common.entity;

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

import org.hibernate.annotations.GenericGenerator;

/**
 * 赋予一个实体UUID主键
 *
 * @author 李永
 *
 */
@MappedSuperclass
public abstract class UUIDEntity {

	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "org.hibernate.id.UUIDGenerator")
	protected String id;

	/**
	 * @return 字符串主键
	 */
	public String getId() {
		return id;
	}

	/**
	 * 设置遮体的主键
	 *
	 * @param id
	 */
	public void setId(String id) {
		this.id = id;
	}
}



你可能感兴趣的:(UUIDEntity)