- This topic has 1 reply, 2 voices, and was last updated 14 years, 8 months ago by Heflin Hogan.
-
AuthorPosts
-
Carl DavisMemberI am attempting to create Spring MVC CRUD scaffolding from the following beans:
public class Product{
private String id;
public String getId() { return id;}
public String setId(String id) { this.id = id;}
}public class Customer{
private String id;
private Set<Product> products;
public String getId() { return id;}
public Set<Product> getProducts{ return products;}
public void setId(String id) { this.id = id;}
public void setProducts(Set<Product> products) { this.products= products;}
}I am deploying into the builtin Tomcat server and using the builtin Derby database. I have successfully built and run similar MVC CRUD generations with stand alone classes and with a single associative class (not a collection). I am using java.util.set due to a tip from a fellow MyEclipse for Spring developer.
This generates code with no errors, but does not deploy due to:
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: Tank, for columns: [org.hibernate.mapping.Column(product)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:269)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1121)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1306)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
… 44 moreThere are more exceptions that this one, but it seems to be the main offender. I will post the complete list if you like.
Are there Java Collection Classes that do work that I can use instead of the interface Set?
Carl
Heflin HoganMemberThe issue you are seeing is Hibernate not knowing what database type to map your products attribute to. This was probably either an oversight or a bug with the scaffolding in the milestone release. We are anticipating MyEclipse for Spring will go GA shortly, so I tested your scenario against our latest internal build. The bad news is that there is a bug where a duplicate classes are created during scaffolding for the beans in your example. This is a known issue, and will be fixed in the followup maintenance release. The good news is that it is easy to deal with (remove the original classes), and once you do, your application will deploy to the built-in Tomcat and Derby servers and run without issue.
-
AuthorPosts