Today i have new problem with JPA/EJB3. I have 2 table User and Group
with mapping OneToMany (Group One – User Many)
When I use select statement in EJB, for example:
@NamedQuery(name = "Iuser.findAll", query = "SELECT i FROM Iuser i")
a conflict occur, it not know group field I choose where table? (group field in User Table is groupid [foreign key] and group field in Group table is Group [Primary Key])
How can i solve this problem?
I know user user.group button statement in EJB3 not execute, please help.
My bet is that the
IGroupentity is mapped on the tableGroupwhich is a reserved keyword and might cause problems if not escaped.If you’re using a JPA 2.0 provider, you can tell the JPA provider to escape the database object name by enclosing the name within double quotes, like this:
If you’re using JPA 1.0, there is no standardized way, it depends on the JPA provider. With Hibernate, you’d have to use backticks:
Or, change the table name for a non reserved keyword:
Does it make sense?