-->
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.  [ 3 posts ] 
Author Message
 Post subject: Help with JPA Annotations please.
PostPosted: Fri Mar 06, 2009 7:02 pm 
Newbie

Joined: Sun Feb 22, 2009 4:25 pm
Posts: 3
Hi all

I'm trying to use JPA Annotations and I can't get it to work.

I think I've done everything well, but I keep getting this MappingException: An AnnotationConfiguration instance is required to use <mapping class="com.video.bean.SimpleUser"/>

I'm testing Annotations with one particular class first.

hibernate.cfg.xml:

Code:
<hibernate-configuration>

<session-factory>   
   ...........
   
   <mapping class="com.video.bean.SimpleUser"/>
   
</session-factory>

</hibernate-configuration>


SimpleUser.java:

Code:
import javax.persistence.*;

@Entity
@Table(name = "SIMPLEUSER")
public class SimpleUser {
   
   @Id @GeneratedValue
   @Column(name = "MAIL")
   private String mail;
   @Column(name = "USERNAME")
   private String userName;
   @Column(name = "PASSWORD")
   private String password;


I really don't know what am I doing wrong.

The exception seems pretty self explanatory, but in the book I'm reading says that adding the mapping tag in the hibernate.cfg.xml is enough.

Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 06, 2009 7:07 pm 
Regular
Regular

Joined: Tue Dec 30, 2008 8:14 pm
Posts: 50
Don't see package declaration at the top of SimpleUser.java

LinHib
----------
Please rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 06, 2009 8:03 pm 
Newbie

Joined: Sun Feb 22, 2009 4:25 pm
Posts: 3
I missed the package declaration while copying, but it is there.

Thanks anyway.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.