-->
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: Map Set<MyEnum> to MySql SET type
PostPosted: Sat May 06, 2006 8:28 pm 
Newbie

Joined: Sat May 06, 2006 8:08 pm
Posts: 4
I'm using Hibernate 3. I need to map a set of JDK 1.5 enums to a MySql SET type. I'm using XDoclet so annotations are preferred. I can work from XML if that's all you can provide. There are multiple enums and some mapped tables have multiples SET columns. hbm2ddl.auto = true so Hibernate is generating the database schema.

Code:
public enum E {E1, E2, E3;}
/**
* @hibernate.class
*/
public class Foo {
  /**
   * @hibernate.id
   */
  private int id;
  /**
   * <annotations here>
   */
  private Set<E> eSet = new HashSet<E>();
  public Foo() {}
}


Code:
CREATE TABLE Foo (id BIGINT(20), eSet SET('E1', 'E2', 'E3'))


Thanks.


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.