Hi,
In our database we have an enumeration of strings. All these strings are actually numbers, for example ['-2', '-1' ,'1' ,'2']. At first I wanted to create an enumerator in Java for this but I couldn't find out how to do it, since enumerated values cannot start with a number. Then I thought that I could use an int in my entity bean. This seem to work pretty good but I could still set the attribute to a value which is not in the enumeration. Also, I cannot confirm that all JPA providers would convert these string values to int values in the same way.
Could someone please help me? I would either like to use an enum or int if enum doesn't work. But I only want to use int if the conversion is within the JPA specification, '-2' becomes int with value -2 for example, otherwise I guess I'll have to use String.
Thanks!
Leo
[Message sent by forum member 'woel' (woel)]
http://forums.java.net/jive/thread.jspa?messageID=240608