-->
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: Do I need to reference entities in BOTH XML files?
PostPosted: Mon Apr 07, 2008 12:50 pm 
Newbie

Joined: Mon Apr 07, 2008 12:45 pm
Posts: 1
I am using Hibernate with EntityManager.

For some reason, unless I define my entity class in both persistence.xml and hibernate.cfg.xml, I get a "xxx is not mapped" exception. If I define it in both, I am fine.

Is there any way around this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 1:23 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I think you should delete one of them, you either use JPA and configure it by using persistence.xml or plain hibernate and use the other configuration file.
Even when using JPA you should be able to set most hibernate options in the persistence.xml.

Or you could include the hibernate configuration in the persistence one using the
Code:
<property name="hibernate.ejb.cfgfile" value="yourhibernate.cfg.xml">

But you certainly don't have to declare the entities in both.

Sanne


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.