Advertisement

06.18.2007 at 11:54PM PDT, ID: 22642460
[x]
Attachment Details

Hibernate annotations : A problem with enumerations

Asked by The_Poet in J2EE Frameworks, Databases Miscellaneous, New to Java Programming

Tags: hibernate, enum, annotation

Hibernate version: 3.2.2

Mapping documents: Use of Annotations

Name of the database you are using: Oracle

Hi all,

I have a class that holds a status.
This Status has been implemented as an Enum class.

I wanted to map this as a "out of the box" String enumeration but after declaring the property with the following annotation :
@Enumerated(EnumType.STRING) : I get no string in my DB, I've tried to set the column to NVARCHAR2 but I just get one long string of characters as value...

What am i doing wrong here ?
In short, I just made a class A that extends from Enum and a class B that holds a property of type A mapped as stated above...

Or is there a smarter way to map Enumerations ?

Thx in advance.Start Free Trial
[+][-]06.19.2007 at 07:51AM PDT, ID: 19316344

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.19.2007 at 08:00AM PDT, ID: 19316450

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.19.2007 at 08:12AM PDT, ID: 19316587

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: J2EE Frameworks, Databases Miscellaneous, New to Java Programming
Tags: hibernate, enum, annotation
Sign Up Now!
Solution Provided By: dejanpazin
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.19.2007 at 08:14AM PDT, ID: 19316602

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.11.2007 at 04:52AM PDT, ID: 19675618

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.27.2007 at 01:23PM PDT, ID: 19778376

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 08:19PM PDT, ID: 19818907

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32