My entities have properties that translate to Java keywords. For example there is a Game
entity and it has property 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; }
//...
}
So far so good, until I generate a static metamodel for my entity and it is generated incorrectly:
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(Game.class)
public abstract class Game_ extends AbstractEntity_ {
public static volatile SingularAttribute<Game, Boolean> private; // <== compilation error
//....
}
I use Hibernate metamodel generator, and I have no idea how to force it to rename problematic attributes. Is there a way to avoid naming problems in generated metamodel classes other than renaming attribute in question?