JPA - 静态元模型和保留关键字

时间:2017-09-11 13:12:46

标签: java hibernate jpa metamodel

我的实体具有转换为Java关键字的属性。例如,有一个Game实体,它有属性private

@Entity
public class Game
{
    //....

    private Boolean PRIVATE; //capitalized to avoid naming issues

    //no need for escaping or renaming, as "private" is not a database, JPA or SQL reserved identifier
    @Column
    public Boolean getPrivate() { return PRIVATE; } 

    //...
}

到目前为止一直很好,直到我为我的实体生成静态元模型并且生成错误:

@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(Game.class)
public abstract class Game_ extends AbstractEntity_ {

    public static volatile SingularAttribute<Game, Boolean> private; // <== compilation error

    //....
}

我使用Hibernate元模型生成器,我不知道如何强制它重命名有问题的属性。有没有办法避免在生成的元模型类中命名问题而不是重命名属性?

0 个答案:

没有答案