Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
TDD for a Shopping Website LiveProject
this week in the
Testing
forum!
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
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Object Relational Mapping
[JPA - Hibernate] Mapping Enum to Column
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have an Enum:
public enum ProductAttributeFormType { TEXT, TEXTAREA, SELECT, MULTISELECT }
And then I have the following Entity class:
@Entity public class ProductAttribute { private Integer id; private String label; private ProductAttributeFormType productAttributeFormType; @ManyToMany private List<ProductAttributeValue> productAttributeValues; }
In order for the productAttributeFormType to just have its value in a column is it as simple as:
@Column(name="FormType")
private ProductAttributeFormType productAttributeFormType;
Or is there more to it?
Thanks,
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ran across
this
. A bit more to it than I though but makes sense.
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
On further inspection, I'm not sure that will work for my use case. So still looking for answers.
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ok, after some
testing
, this appears to work...
@Enumerated(value = EnumType.STRING)
private ProductAttributeType productAttributeType;
Rodrigo Lopes
Ranch Hand
Posts: 121
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes, that's the way
--
Rodrigo Lopes
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JPA - Hibernate - query.getResultList() returns 3 null values.
Best practice of mapping collection of enum
Mapping enum in JPA/Hibernate
Problem Persisting Entity In Hibernate
Can I create a drop down menu from an enum
More...