我们的应用程序有几个实体,是用MySQL
数据库开发的。我们所有的实体extends
都是一个共同的基础实体。
@MappedSuperclass
public class BaseEntityData implements Serializable
{
/**
* Data identifier (Usually holds Primary Key)
*/
private Long id;
/**
* @return the id
*/
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
public Long getId()
{
return id;
}
/**
* @param value the id to set
*/
public void setId(final Long value)
{
this.id = value;
}
}
我们所有的实体都扩展了BaseEntityData
,一切都在MySQL
数据库上完美运行。我们没有Oracle database
在开发过程中进行测试。我们现在想测试Oracle database
不同客户需求的 cos,但发现Oracle database
不会为主键生成序列号,有时会生成重复键。如何修改这个超类BaseEntityData
以便为我们所有的表生成唯一的键。有超过 300 个实体扩展了这个超类。