Q:

Intellij IDEA jpa console issue select from tables with specific columns

We have a project includes Eclipselink and MySQL.
For example if we use simple query:
SELECT a from ExampleTable a

it is transformed to something like this:
SELECT `id`, `code`, `high`, `key`, `name`, `regionalCode` FROM `ExampleTable`

and if I am using JPA Console I am getting something like that:
SELECT id, code, high, key, name, regionalCode FROM ExampleTable

and error message
[42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key, name, regionalCode FROM ExampleTable' at line 1

The problem is "key" column but I have no chance to rename it.
I tried to find options to fix that but have no results.
I think if there will be no answer - the good way is to create bug report.
How we get enclosed names of columns?
We are using EntityManager
EntityManager em;
...
TypedQuery = em.createQuery("SELECT et FROM ExampleTable et");

And if we run it we see (in debug mode) that all names in generated query are enclosed with ` symbol.

A:

key is reserved keyword of MySQL database (see MySQL: Reserved Words).
so you should escape reserved keyword in your mapping.
You can do it in the following way:
@Table
@Entity
public class ExampleTable implement Serializable
{
   // ...
   @Column(name = "'key'") // or @Column(name = "\"key\"")
   private String key;
   //...
}

