-->
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: MappingException when executing JUnit tests in Eclipse
PostPosted: Wed Aug 20, 2008 6:18 pm 
Newbie

Joined: Thu Nov 29, 2007 3:07 pm
Posts: 2
Hello -

I've recently joined a team that has created quite a few unit tests over their source code. They are run as part of our ant/cruise-control based continuous build and run successfully. This is good!

However, when I try to run them within Eclipse by right-clicking on my project name, and selecting 'run as->junit test' (which I believe will find all junit tests in the project and run them in some order I can't discern), I get many jUnit Errors, all of the format:

org.hibernate.MappingException: Unknown entity: package.name.class.name (where my specific details are obviously here)

The specific class varies depending on the test.

However, when I attempt to execute any of the failed tests individually they work.

I assume this must be an ordering problem, or an issue with configuring hibernate multiple times (each test class typically does a configure in its setup method).

I'd really appreciate any pointers. I'm not sure anyone else in the team has tried this!

Thank you
Mike


Top
 Profile  
 
 Post subject: MappingException when executing JUnit tests in Eclipse
PostPosted: Fri Aug 22, 2008 8:17 am 
Newbie

Joined: Thu Nov 29, 2007 3:07 pm
Posts: 2
Some more info on this:

- looks like when we execute our unit tests via the Ant task, we have 'fork' set to 'yes'; this implies each test class gets it's own clean jvm
- in eclipse, all tests you choose to execute together get a single jvm
- in each of our jUnit setUp methods, we configure Hibernate, but with different hbm files

So, I'm wondering if the subsequent calls to configure (within the same jvm) are just being ignored. I don't see any warnings to this effect in the logs, but I am getting the mapping exception when we attempt to call 'save'.

Mike


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.