-->
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.  [ 1 post ] 
Author Message
 Post subject: java.lang.IllegalArgumentException: No enum const class
PostPosted: Fri Dec 09, 2011 11:34 am 
Newbie

Joined: Fri Dec 09, 2011 11:11 am
Posts: 2
I am getting started with Hibernate, and I am getting the following error for an entity which is supposed to have an enum type.
java.lang.IllegalArgumentException: No enum const class app.entity.ObjType.
java.lang.Enum.valueOf(Enum.java:214)
org.hibernate.type.EnumType.nullSafeGet(EnumType.java:125)
org.hibernate.type.CustomType.nullSafeGet(CustomType.java:109)
org.hibernate.type.AbstractType.hydrate(AbstractType.java:104)
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)

I have the following enum type defined:
@Enumerated(EnumType.STRING)
private ObjType type;

And the defined Enum class is as follows:

package app.entity;

public enum ObjType {
typeA,
typeB
}

What am I doing wrong? Also do set and get methods also have to be annotated with "@Enumerated(EnumType.STRING)" ?

I would appreciate any help.
Thanks


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

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.