Tuesday, September 25, 2012

Grails -Error- expected "identifier"; SQL statement: insert into XYZ Table

Syntax error in SQL statement "INSERT INTO ORDER[*] (ID, VERSION, ADDRESS_ID, NAME, SHIPPING_DATE, USER_ID) VALUES (NULL, ?, ?, ?, ?, ?) "; expected "identifier"; SQL statement: insert into order (id, version, address_id, name, shipping_date, user_id) values (null, ?, ?, ?, ?, ?) [42001-164]


This error shows up when you are using any keyword of database you are using in your Grails app.

I was using the Order Domain class and H2 database . i need to modify the class to avoid this error.


class Order implements java.io.Serializable{

    String name
    String shippingDate
    Address address
    User user
    static mapping = { table 'my_order' }
    static constraints = {
        name(nullable:true,blank:false)
        shippingDate(nullable:true,blank:false)
        address(nullable:true,blank:false)
        user(nullable:true,blank:false)
    }
}

No comments:

Post a Comment