-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate session factory not able to resolve enum type
PostPosted: Wed Feb 15, 2012 6:20 pm 
Newbie

Joined: Mon Feb 13, 2012 1:55 pm
Posts: 4
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


Top
 Profile  
 
 Post subject: Re: Hibernate session factory not able to resolve enum type
PostPosted: Thu Feb 16, 2012 2:45 pm 
Newbie

Joined: Mon Feb 13, 2012 1:55 pm
Posts: 4
You get the exception even if you use List<String>. If you declare the field as 'private ArrayList<WifiConstants.AuthAlgorithm> ...' (i.e. ArrayList instead of List), the exception goes away. Is this a known issue?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.