-->
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: EnumType.STRING in @Embeddable not work
PostPosted: Thu Dec 09, 2010 4:51 pm 
Newbie

Joined: Mon Jun 20, 2005 12:20 pm
Posts: 17
Hi, In my User class, I have

Code:
@CollectionOfElements(fetch = FetchType.EAGER)
@JoinTable(name = "user_privilege")
protected Set<Privilege> privileges;


Privilege is an embeddable class

Code:
@Embeddable
public class Privilege {
   @Enumerated(EnumType.STRING)
   @Column(name="function", nullable = false)
   protected Function function;

   @Enumerated(EnumType.STRING)
   @Column(name="access", nullable = false)
   protected Access access;
...
}

The problem is that @Enumerated(EnumType.STRING) tags in Privilege seem ignored, and the ordinal values are stored:

Code:
CREATE TABLE `user_privilege` (
  `user_id` bigint(20) NOT NULL,
  `access` int(11) DEFAULT NULL,
  `function` int(11) DEFAULT NULL,
  KEY `FK45FBD628C91846B3` (`user_id`),
  CONSTRAINT `FK45FBD628C91846B3` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
)


I am using hibernate-jpa-2.0-api-1.0.0.Final.jar and hibernate3.jar

Any help will be appreciated,
-ZJ


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.