Details
-
Type:
Improvement
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0.0.M2
-
Fix Version/s: 1.0.0.RC1
-
Component/s: PERSISTENCE
-
Labels:None
-
Reference URL:
Description
This was reported by Ronald Vermeire in the Roo forums. Thanks Ronald!
The following script will fail on 'mvn test' with the following exception:
Unsuccessful: create table product_group (id bigint not null auto_increment, version integer, index varchar(255), postfix bigint, prefix bigint, primary key (id))
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 'varchar(255), postfix bigint, prefix bigint, primary key (id))' at line 1
This might be a problem in Hibernate (generating an invalid SQL query or the MySQL driver itself.
The following script reproduces the issue:
create project -topLevelPackage com.foo
install jpa -database MYSQL -provider HIBERNATE
new persistent class jpa -name ~.Prefix -testAutomatically
add field string -fieldName name
new persistent class jpa -name ~.ProductGroup -testAutomatically
add field string -fieldName name
add field reference jpa -type com.foo.Prefix -fieldName prefix
However, changing the @ManyToOne mapping annotation in ProductGroup to have an explicit 'targetEntity' attribute fixes the issue:
@ManyToOne(targetEntity=Prefix.class)
@JoinColumn
private Prefix prefix;
So as a workaround we should include the targetEntity attribute by default.