In Oracle, if you name a table User, you must query the table by putting quotes around the word user.
This will not work
select * from User
This will work
select * from "User"
My question is, how do I run a hibernate HQL query on a table named User? I have tried putting "" around User, escaping quotes, single quotes, nothing works. HQL doesn't like those characters and errors out. I have googled and searched for a solution and found nothing.
You need to escape the table name, in your entity mapping:
@Entity
@Table(name="`User`")
public class User {
...
}
The when you write an HQL query like this:
from User
Hibernate will generate an SQL query like this:
select * from "User"