org.hibernate.exception.SQLGrammarException: could not execute statement
In MySQL USING is reserved word.
So just rename the table by using @javax.persistence.Table
annotation on your Using
entity.
Something like
@Entity
@Table(name = "TB_USING")
public class Using {
...
}
I assumed you have a table for USING
, but you mentioned that it is a one-to-many relationship, so you can omit the table, and model it using just a single foreign key in Reader
table.
By the way hibernate does not force you to create a new entity for many-to-many join tables (which don't have any more attribute but the foreign keys). But I believe it is a good practice to have an entity for that relationship, cause most of the times some attributes will be defined for the relation in future.