Hi,

I'm not sure I understand. Are you asking how to get a Java enum to use your special values, or for OpenJPA to map your special type?

Java enum types assign the ordinal values without any help from the programmer. If you want your own values, ordinal isn't the right concept. You would need your own value type as an extra attribute of your Enum class, and then use a special OpenJPA mapping to get the values to and from the database.

Craig

On Dec 17, 2009, at 11:33 AM, KARR, DAVID (ATTCINW) wrote:

I'm trying to map a field that is essentially an enumerated type.  The
ordinal values are stored in the DB.  I can specify
"@Enumerated(EnumType.ORDINAL)" on the field, and then in the definition
of my Java enumerated type, I can define the possible values I can
expect.  What seems to be missing here is that I have to map specific
ordinal values. I can't just assume the first value maps to "0", and so on. I don't see an obvious way to define an enumerated type where I can
set the ordinal values.  Am I missing something simple here?

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!

Reply via email to