0

I am having a problem refactoring my code to use the JPA ElementCollection instead of the deprecated CollectionOfElements. I am seeing the following stack trace:

org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: UserFilter, for columns: [org.hibernate.mapping.Column(element)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:292) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276) at org.hibernate.mapping.Property.isValid(Property.java:207) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458) at org.hibernate.mapping.JoinedSubclass.validate(JoinedSubclass.java:63) at org.hibernate.cfg.Configuration.validate(Configuration.java:1149) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1334) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

The changed code in UserFilter is below:

//@CollectionOfElements
@ElementCollection(targetClass = String.class)
@CollectionTable(name="UserFilter_orgUnits", joinColumns=@JoinColumn(name="UserFilter_FILTER_ID"))
@Column(columnDefinition = "varchar(255)", name="element")
private Set<String> orgUnits = new HashSet<String>();

I am specifying the join table name and column name for backwards compatibility.

PeterD
  • 51
  • 1
  • 4
  • Can you add the id mapping on the UserFilter entity? Also it would be helpful to show the table structure of the UserFilter_orgUnits table. I am guessing that it what is show below but it would be nice to add to the question. userfilter_orgunits(UserFilter_FILTER_ID INT NOT NULL,element VARCHAR(255)) – Manuel Quinones Jan 09 '13 at 17:03
  • It appears as tho I have mis-matched Hibernate jars from incompatible versions. I will try this using the 4.1.9 jars. – PeterD Jan 09 '13 at 17:19

0 Answers0