Issue Type: Bug Bug
Affects Versions: 4.1.3
Assignee: Unassigned
Components: core
Created: 22/Jul/12 10:20 PM
Description:

I created an object, InvoiceItem, that I wanted to persist and gave it an "Integer index" field, with Integer getIndex() and void setIndex() public methods. This object was then referenced by the Invoice class in a SortedSet<InvoiceItem> field. The SortedSet<InvoiceItem> field had the following annotation:

@OneToMany( cascade = CascadeType.ALL, fetch = FetchType.EAGER )
@JoinTable(name = "vgs4_join_invoice_to_invoice_item", joinColumns = { @JoinColumn(name = "invoice_id") }, inverseJoinColumns = { @JoinColumn(name = "invoice_item_id") })
@Sort( type = SortType.NATURAL )

Upon starting my program, I got Hibernate errors telling me of an SQL syntax error. Took a bit of looking around and copy-pasting the SQL into a terminal to realize that "index" is a MySQL keyword. Changed field to "invoiceIndex" and the problem went away.

I dunno anything about the Hibernate source, but this issue should simply be a matter of throwing a specific, detailed error if a field named "index" is detected and MySQL (or any other database with "index" as a reserved word) is in use.

Environment: Arch Linux x64, MySQL 5.5
Project: Hibernate ORM
Priority: Minor Minor
Reporter: Alex Corn
Original Estimate: 2h
Remaining Estimate: 2h
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira