How to make Eclipse respect \" for delimited identifiers in JPA 2.0?

772 views Asked by At

According to JPA 2.0 spec, when defining delimited identifiers (useful for those that match reserved words) escaped double quotes \" must be used. For instance, an entity in a table named USER should be annotated @Table(name = "\"USER\"").

In 1.0 this was not specified and a workaround would consist in using whichever database syntax was. For instance, using backticks ` in MySQL, @Table(name = "`USER`"), or square brackets [] in SQL Server, @Table(name = "[USER]").

When validating classes, Eclipse seems not to be respecting the quoting in JPA 2.0 and resolves the identifier plainly with the double quotes. Although I'm using EclipseLink 2.5.2 in Eclipse Luna, that should be up to date, it is unable to resolve the identifiers quoted as specified, and thus marks it as an error.

From what I've investigated, it seems to be some problem between Dali (the persistence plugin) and the DTP (that provides the access to the databases). When using non delimited identifiers it resolves fine, but those are required to make it work with JPA Tools and deployed, this just happens in the Eclipse IDE.

Is there a workaround to make it resolve those elements properly?

Using double quotes acording to JPA 2.0

Using MySQL notation

Information of the marker

JPA configuration in Eclipse

0

There are 0 answers