This content has been marked as final.
Show 4 replies
-
1. Re: How to map an array or a list of enums?
waynebaylor Jun 11, 2007 9:40 PM (in response to grettke_spdr)I'm not sure, but I've only seen persistent Collections being used with Hibernate--not arrays.
Have you tried using aList<UnderwritingConcernEnum>
orSet<UnderwritingConcernEnum>
instead of an array? -
2. Re: How to map an array or a list of enums?
grettke_spdr Jun 12, 2007 11:33 AM (in response to grettke_spdr)"waynebaylor" wrote:
I'm not sure, but I've only seen persistent Collections being used with Hibernate--not arrays.
Have you tried using aList<UnderwritingConcernEnum>
orSet<UnderwritingConcernEnum>
instead of an array?
I getjavax.persistence.PersistenceException: org.hibernate.MappingException: Could no t determine type for: java.util.Set, for columns: [org.hibernate.mapping.Column( concerns)]
When I try a set or a list. It seems like it expects me to use a @OneToMany and specity the targetEntity type here, but I don't want to unless I must.
I was hoping I could get away with enums for specifying options. -
3. Re: How to map an array or a list of enums?
waynebaylor Jun 12, 2007 2:29 PM (in response to grettke_spdr)So, I was wrong about the array. Hibernate does support arrays, but they're rarely used since Hibernate can't optimize them like Collections.
As far as using enums, here are some links:
http://www.hibernate.org/270.html
http://forum.hibernate.org/viewtopic.php?t=933393
http://www.nabble.com/Java-5-Enums-Persistence-::-How-to-t3865408s2369.html
The solution may be bigger than your problem :) -
4. Re: How to map an array or a list of enums?
grettke_spdr Jun 12, 2007 2:59 PM (in response to grettke_spdr)"waynebaylor" wrote:
So, I was wrong about the array. Hibernate does support arrays, but they're rarely used since Hibernate can't optimize them like Collections.
As far as using enums, here are some links:
http://www.hibernate.org/270.html
http://forum.hibernate.org/viewtopic.php?t=933393
http://www.nabble.com/Java-5-Enums-Persistence-::-How-to-t3865408s2369.html
The solution may be bigger than your problem :)
Interesting. Thus far I haven't had a problem with (single) enums. I use the built in annotation.@Enumerated(EnumType.ORDINAL) public InspectionPriorityEnum getPriority() { return priority; }
It is collections of enums that are vexing me.
Is the approach taken in those links something akin to the solution for mapping collections?