• Post Reply Bookmark Topic Watch Topic
  • New Topic

hibernate mapping files for enumerated strings.  RSS feed

peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am a beginner. with hibernate

I have realized I am missing something obvious. Not sure what it is, Hoping somene an help me see what I am not seeing.

My companies existing software starts with mapping files and generates schema and java files.

I am trying to figure out how to map. given a table with a varchar() column "state" that can have only 1 on a limited number of strings: 'DOES_NOT_EXIST', 'NEW,INITIATILIZE', 'RUNNING', 'TEARDOWN'


and an enum representing the string values of the column.
public enum StatEnum {

what we want to do is something along the lines of

StateMachine machine = new StateMechine();
Problems is I am receiving "Can't commit transaction: Could not execute JDBC batch update: ORA-00932: inconsistent datatypes: expected BINARY got NUMBER"

I think the HBM mapping file should be something along the lines of com.foo.StateEnum 12

Can some point me at some documentation that does what I am trying to do. Do I need to define a user type.

Thanks for helping me to learn...
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!