I have this field in an Entity class which is a collection of an enumeration:
Code:
...
@ElementCollection(fetch=FetchType.EAGER)
@JoinTable(name="wifi_network_config_auth_algorithm")
@JoinColumn(name="wifi_network_config_id", referencedColumnName="id")
@Enumerated(EnumType.ORDINAL)
private List<WifiConstants.AuthAlgorithm> authAlgorithm = new ArrayList<WifiConstants.AuthAlgorithm>();
public List<WifiConstants.AuthAlgorithm> getAuthAlgorithm() {
return authAlgorithm;
}
public void setAuthAlgorithm(List<WifiConstants.AuthAlgorithm> authAlgorithm) {
this.authAlgorithm = authAlgorithm;
}
...
Within WifiConstants, AuthAlgorithm is declared as:
Code:
public enum AuthAlgorithm { LEAP, OPEN, SHARED }
I get this exception when I run the application under jetty:
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Column(authAlgorithm)]: org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Column(authAlgorithm)]
The question is, how do you tell the SessionFactory about the WifiConstants.AuthAlgorithm enumeration type? That's what it's not able to find. I tried adding the WifiConstants class where the enum is defined to the list of beans given to spring's hibernate session factory (with the "annotatedClasses" property), but it did not help. Also tried moving AuthAlgorithm enum definition to its own AuthAlgorithm.java file - that did not help either.
Thanks, Hari