-->
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: persisting a set of enums
PostPosted: Mon Jun 29, 2009 8:15 am 
Beginner
Beginner

Joined: Wed Mar 22, 2006 4:33 am
Posts: 20
Location: Berlin, Germany
Hi there,

I'm trying to persist a Set of enums using JPA annotations only. Unfortunately I either get an error about the enum class not being mapped (if I annotate the set with @ManyToMany) or about Hibernate not being able to determine a type for java.util.Set (if I omit the @ManyToMany annotation). I have the feeling that Hibernate (at least 3.3.1.GA) is not capable of persisting a set of enums, is that right?

Below is a sample of what I'm trying to do.

Uli

Code:
@Entity
public class ProjectUserRole extends BaseEntity
{
    ...

    @ManyToMany
    @Enumerated(EnumType.ORDINAL)
    public Set<Role> getRoles()
    {
        return roles;
    }

    public void setRoles(Set<Role> roles)
    {
        this.roles = roles;
    }
}


With Role being a Java enum.


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.