• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Enums

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am using maven's jpa-maven-archetype with eclipse to build my first EJB 3.0/JPA project. i am having a problem mapping an enum to the database though. my enum use is simple enough:



when i build with maven and test, i get this:


i'm not really sure if it matters but since i am relying on maven to do some of the dirty work that i dont yet understand, this is the dependencies in my pom.xml file in case i have done something wrong there:


finally, my persistence.xml file looks like this:


also, is it possible to map an enum to a reference table? So that instead of the enum value by ordinal or string it would join to some other table that had the constant definitions mapped to some number?

one other question i have about all this is that if i remove the enum variable then everything seems to work except the price value in my Anvil class shows up as double in the mysql database and the precision or scale does not get defined. why is that?
 
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ra Carter:




To me, this looks more like an issue with a generated ID than with an enum.
In any case, it would help to see the ID mapping within the class and the code that inserts the object.
[ November 26, 2007: Message edited by: Edvins Reisons ]
reply
    Bookmark Topic Watch Topic
  • New Topic