Thursday, 5 September 2013

Collection Enums converter

Collection Enums converter

Can I do something like this in DataNucleus 3.1.3?
public class User {
enum MyType {A, B};
@Id @GeneratedValue
private Long id;
@Basic
@Convert(converter = ListOfStringsToStringAttributeConverter.class)
@Enumerated(EnumType.STRING)
private Collection<MyType> types;
}
I would like to achieve that types field are stored like a comma-separated
string in the database, e.g. "A,B"

No comments:

Post a Comment