File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Enums

 
Ra Carter
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Edvins Reisons
Ranch Hand
Posts: 364
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic