Play 2.0 Framework - Reserved Table Name

I have created a model called Group which in turn should create the table group. As a result the database evolutes with errors, saying 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 keep my 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;
    }

}

Any help would be greatly appreciated!

Answers


Simple use

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

Something which describes the table without a reserved word.


Maybe this will help:

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

If not, try:

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

If not, try:

https://stackoverflow.com/a/1565765/952046

EDIT

MySQL docs says:

Most of the words in the table are forbidden by standard SQL as column or table names (for example, GROUP).

Furthermore:

The identifier quote character is the backtick (“`”):

mysql> SELECT * FROM `select` WHERE `select`.id > 100;

So it should work. Maybe there's sth wrong with quotes - make sure you use tick mark (\``), not a single quote ('). You can also try settingmysql> SET sql_mode='ANSI_QUOTES';. Check if you can create table namedgroup` from MySQL console.


Need Your Help

Using material-ui in client-side requireJS environment?

javascript gruntjs requirejs amd material-ui

I've been researching for a couple hours now on how to include material-ui as a client-side AMD module for my application, and here is the closest I've come. Using grunt-amd-wrap, I used the follow...

Google Cloud Messaging shows "notRegistered" when using iOS distributed app

android ios iphone xcode ssl

I have implemented a GCM service on an iOS app. I use PHP to send GCM at the server. It works perfectly when the app is signed by a development provisioning profile.