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.