我希望 JPA EclipseLink 完全按照 ClassName(和字段)创建表,而无需注释 @Table 和 @Column。它总是使用大写创建表和字段,这使得数据库控制台的可读性变得困难。
例如:
@Entity
public class ChannelEntity {
@Id @GeneratedValue
public Long id;
public String name;
public String description;
public Boolean oficial;
@Temporal(TemporalType.TIMESTAMP)
public Date creation;
}
我想要结果
Table: ChannelEntity
id creation description name oficial
----------------------------------------------------
351 NULL meu desc meu nome 1
也许 persistence.xml 中存在相同的参数,但我找不到它。
最佳答案
如果 EclipseLink 运行正常,则您要查找的参数为 delimited-identifers
。来自 JPA 2.1 规范:
It is possible to specify that all database identifiers in use for a persistence unit be treated as delimited identifiers by specifying the
<delimited-identifiers/>
element within thepersistence-unit-defaults
element of the object/relational xml mapping file. If the<delimited-identifiers/>
element is specified, it cannot be overridden.
如果包含此元素,EclipseLink 应在其生成的 SQL 中分隔所有数据库标识符,这将导致使用区分大小写的名称创建数据库对象。
关于java - 如何强制 Eclipse Link 创建完全相同的 ClassName 的表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41066606/