CPA
CPA

Reputation: 3063

Hibernate 5 still ignores @Table annotation to find tables

Does Hibernate still ignores the @Table name annotation? All my tables are named in CamelCase strategy. Is there any way to use the annotations or do I have to write my own naming strategy?

Upvotes: 1

Views: 320

Answers (1)

fg78nc
fg78nc

Reputation: 5232

According to JSR 338, JPA 2.1

To specify delimited identifiers, one of the following approaches must be used:

• It is possible to specify that all database identifiers in use for a persistence unit be treated as delimited identifiers by specifying the element within the persistence-unit-defaults element of the object/relational xml mapping file. If the <delimited-identifiers/> element is specified, it cannot be overridden.

• It is possible to specify on a per-name basis that a name for a database object is to be interpreted as a delimited identifier as follows: • Using annotations, a name is specified as a delimited identifier by enclosing the name within double quotes, whereby the inner quotes are escaped, e.g., @Table(name="\"customer\""). • When using XML, a name is specified as a delimited identifier by use of double quotes, e.g., <table name="&quot;customer&quot;"/>

Upvotes: 1

Related Questions