-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to persist a list using JPA and hibernate
PostPosted: Sun Jan 18, 2009 5:38 am 
Newbie

Joined: Wed Dec 17, 2008 2:37 am
Posts: 4
Hi,

I am using Spring , JPA and hibernate..

1) How can one persist a list of objects?

2) Is it possible to persist a list of enums ?

I am getting these exceptions :

a) org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Column(features)]

when I define field as
List<PropertyFeature> features;
// property feature is defined with @Entity

b) if I add any sort of annotation like @oneToMany etc. then I am getting this error :
org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.hestia.property.Property.features[tags.PropertyFeature]


Can anyone guide me to good resources for persisting using hibernate, with JPA and Spring.. I am completely new to hibernate and don't know how to use mapping files and can't find a good resource on this way of using hibernate!

Thanx in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 20, 2009 1:54 pm 
Newbie

Joined: Wed Oct 01, 2008 8:42 pm
Posts: 12
Both:

http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/#entity-mapping-association

And

http://www.hibernate.org/hib_docs/v3/reference/en-US/html_single/#collections-mapping

Are probably the best resources for this.

You will need to specify one-to-many or many-to-many on this field. The org.hibernate.AnnotationException you are receiving is likely because:

a) PropertyFeature is not mapped with an @Entity. It needs to be a mapped instance as well.

b) PropertyFeature is mapped, but Hibernate can't find it. Not sure how you are using spring/hibernate but likely there is some place where you specify packages or classes that are mapped for hibernate to look. Make sure that PropertyFeature is included in this list.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.