-->
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: ClassCastException with Enumerated CollectionOfElements
PostPosted: Mon Jun 28, 2010 5:22 pm 
Newbie

Joined: Thu Oct 07, 2004 3:53 pm
Posts: 10
I have the following mapping
@Entity
@Table(name = "av_contribution")
public class Contribution {

.....

@CollectionOfElements(targetElement = BoardKind.class)
@Enumerated(EnumType.STRING)
@JoinTable(name = "av_contrib_boardkind", joinColumns = @JoinColumn(name = "cid"))
Set<BoardKind> boardKinds = new HashSet<BoardKind>();

.....

When I do a merge of this entity I get:

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum
at org.hibernate.type.EnumType.nullSafeSet(EnumType.java:134)
at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:146)
at org.hibernate.persister.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:755)
at org.hibernate.persister.collection.AbstractCollectionPersister.insertRows(AbstractCollectionPersister.java:1364)
at org.hibernate.action.CollectionUpdateAction.execute(CollectionUpdateAction.java:56)

Using hibernate 3.2.5.ga

Any help greatly appreciated!


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.