Play 2.0 Framework - Reserved Table Name

I created a model called Group, which in turn should create a group of tables. As a result, the database evolves with errors, saying that the table name is a reserved word. Due to the fact that my model / table name is a reserved word, I would like to know if there is a way to save a table named group.

Here is an example of my group model (Play Framework 2.0):

 @Entity public class Group extends Model { @Id private long id; @Required private String groupName; private static Model.Finder<Long,Group> find = new Model.Finder<Long,Group> (Long.class, Group.class); public Group() { } public Group(String groupName) { this.groupName = groupName; } /*** Getters & Setters ***/ public long getId() { return id; } public void setId(long id) { this.id = id; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } } 

code>

Any help would be greatly appreciated!

+4
source share
2 answers

Simple use

 @Entity @Table(name="groupOfxxx") public class Group { 

Something that describes a table without a reserved word.

+2
source

Perhaps this will help:

 @Entity @Table(name="`group`") public class Group { 

If not, try:

 @Entity @Table(name="group") public class Group { 

If not, try:

fooobar.com/questions/1417822 / ...

EDIT

MySQL docs says:

Most words in a table are prohibited by standard SQL as a column or table names (e.g. GROUP).

In addition :

 The identifier quote character is the backtick ("`"): mysql> SELECT * FROM `select` WHERE `select`.id > 100; 

So that should work. Maybe something is wrong with quotation marks - make sure you use the checkmark ( \``), not a single quote ( ' ). You can also try setting ). You can also try setting mysql> SET sql_mode = 'ANSI_QUOTES'; . Check if you can create table named . Check if you can create table named group` from the MySQL console.

+1
source

All Articles