0

I have a domain class name DataList

@Entity
@Table(name = "list_data")
public class ListData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "sys_id")
private String sysId;
@Column(name = "name")
private String name;
@Column(name = "detail")
private String detail;
@Column(name = "values")
private String values;

   //getters and setters
  }

I have some others domain class.. I'm using hibernate 3.6 everything alright.

but somehow Im unsuccessful while creating this table.

2012-02-25 03:31:52,166 ERROR SchemaExport:274 Unsuccessful: create table list_data (id >integer not null auto_increment, detail varchar(255), name varchar(255), sys_id varchar(255), >values varchar(255), primary key (id)) 2012-02-25 03:31:52,167 ERROR SchemaExport:275 You have an error in your SQL syntax; check the >manual that corresponds to your MySQL server version for the right syntax to use near 'values >varchar(255), primary key (id))' at line 1

I know my hibernate configuration is fine, I have some other domain class, they are working just fine.

1 Answer 1

3

I think that you cannot use values as a column name since it is a MySQL keyword (INSERT INTO ... VALUES() ).

Sign up to request clarification or add additional context in comments.

1 Comment

That would be my guess as well. In general when I use hibernate I label columns with f_ and tables with t_ to avoid reserved names issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.