Hello,
When i save this class.
Code:@Entity
@RooEntity
@RooJavaBean
@RooToString
public class Productgroup {
@NotNull
@Size(max = 30)
private String name;
@OneToMany(cascade = CascadeType.ALL)
private Set<Prefix> prefixes = new HashSet<Prefix>();
@OneToMany(cascade = CascadeType.ALL)
private Set<Postfix> postfixes = new HashSet<Postfix>();
}
I get a the following error.
Quote:
Caused by: java.sql.BatchUpdateException: Duplicate entry '1' for key 2
at com.mysql.jdbc.PreparedStatement.executeBatchSeria lly(PreparedStatement.java:1666)
at com.mysql.jdbc.PreparedStatement.executeBatch(Prep aredStatement.java:1082)
at org.apache.commons.dbcp.DelegatingStatement.execut eBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch( BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(Ab stractBatcher.java:246)
... 107 more
This only occurs when i use hibernate with mysql not when i use openjpa with mysql. To reproduce execute the attached script, run wepapp, create some prefixes and postfixes, create two productgroups that have a relation to the same prefix or postfix.
Kind regards,
Ronald Vermeire
