You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Mansour Al Akeel <ma...@gmail.com> on 2012/03/05 03:16:26 UTC
Enumeration Type default to EnumType.STRING
Hello,
I need to persist enum values as a string.
This example http://www.java2s.com/Tutorial/Java/0355__JPA/JavaEnumMappedToVarchar.htm
shows how to do it, using
@Enumerated(EnumType.STRING)
private Gender gender;
which will work fine. However To keep all the fields in all the
entities consistent, I need to use strings only.
And because I am using some enum in many places, I need to set the
default to persist by String. So is there a ways to omit the
@Enumrated annotation and still get it the String type persisted ?
For example, use only:
private Gender gender;
Thank you.