-->
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: Set of @Enumerated problem/question
PostPosted: Mon May 22, 2006 11:31 am 
Newbie

Joined: Thu Jan 13, 2005 10:04 am
Posts: 18
I have an enum mapped as a CollectionOfElements like:

private Set<MyEnum> type = EnumSet.noneOf(MyEnum.class);

@CollectionOfElements(fetch = FetchType.LAZY)
@JoinTable( name="enumtable",
joinColumns = { @JoinColumn( name="id") })
public Set<MyEnum> getType() {
return type;
}

This allows me to save multiple enummerated types for a given entry e.g.

parent.setType(EnumSet.of(Style.BOLD, Style.ITALIC));

I am also able to search using the ordinal value of the enum (not sure if this is the recommned approach - I am sure I will be told otherwise...)

What I am unable to do, however, is return and instance of the parent object (the one that has owns the CollectionOfElements) and get the type.

java.lang.IllegalArgumentException: Unknown name value for enum class.

Is there a way I can declare that the Set I am saving/retrieving is of an enum type, maybe using somethign like: @Enumerated(value=EnumType.ORDINAL)


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.