-->
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: (Another) Enum Mapping Question
PostPosted: Mon May 09, 2011 7:07 am 
Newbie

Joined: Sat Apr 16, 2011 5:43 am
Posts: 3
Hi,

I've reviewed several other posts, and apologise if this (repeated) issue grates folks, but can't understand why my annotations aren't persisting my enum as its string representation; instead, it's persisting it as a serialized object (it seems).
The enum:
Code:
public enum CommentSource{
   MAIL,
   EMAIL,
   PHONE,
   WEB;

The class:
Code:
@Entity
public class Comment {
   @Enumerated(EnumType.STRING)
   private CommentSource source;

   public void setSource(CommentSource s){
      this.source = s;
   }
   public CommentSource getSource(){
      return this.source;
   }


I would expect my implementing class to persist "EMAIL" when going:

Code:
myPojo.setCommentSource(CommentSource.EMAIL);


My HBM file simply contains:

Code:
<property name="source" column="COMMENT_SOURCE" type="entity.CommentSource"/>


I'm using 3.6.3 and mySQL 5.5.

Thanks in advance


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.