-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to disable the HbmBinder when using JPA?
PostPosted: Mon Nov 08, 2010 3:57 am 
Newbie

Joined: Thu Nov 01, 2007 1:43 pm
Posts: 5
Hi,

I am developing a project in which i am using JPA entities along with some entities mapped in xml files.

While testing, i don't want Hibernate to load the entities mapped in the xml files. What it does it that it automatically searches for .hbm.xml files in the classpath and loads the entities mapped in the same. And this creating lot's of problems for me.

So is there a way by which i can disable automatic classpath scanning in Hibernate 3.6 when using JPA?


Top
 Profile  
 
 Post subject: Re: How to disable the HbmBinder when using JPA?
PostPosted: Mon Nov 08, 2010 7:00 pm 
Beginner
Beginner

Joined: Tue Oct 26, 2010 6:12 pm
Posts: 29
Quote:
it automatically searches for .hbm.xml files in the classpath


AFAIK, this does not happen automatically. The mapping files are typically mentioned explicitly in some location (in the hibernate.cfg.xml or in your Spring configuration).

How are you configuring your session factory?


Top
 Profile  
 
 Post subject: Re: How to disable the HbmBinder when using JPA?
PostPosted: Mon Nov 08, 2010 11:34 pm 
Newbie

Joined: Thu Nov 01, 2007 1:43 pm
Posts: 5
No, it's not like that. It's picking up automatically. When using JPA, there is no need of hibernate.cfg.xml. The temporary solution is i've to use auto-import=false in all my hbm files so that it doesn't gives me duplicate entity error, since i've classes by the same name in many packages. But from the logs i see, it's still picking up all hbm files from the classpath and loading the configuration from them. So i just need this HbmBinder who still get's loaded when instatiating an EntityManagerFactory to be somehow disabled.

I am not using Spring right now.


Top
 Profile  
 
 Post subject: Re: How to disable the HbmBinder when using JPA?
PostPosted: Tue Dec 21, 2010 2:57 pm 
Newbie

Joined: Tue Oct 13, 2009 2:21 pm
Posts: 2
Just add <exclude-unlisted-classes/> to your persistence.xml file.


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