Loading hbm files under default hierarchy from test hierarchy

View: New views
2 Messages — Rating Filter:   Alert me  

Loading hbm files under default hierarchy from test hierarchy

by valentin_jacquemin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
I am building a project architecture and facing an issue with classloading.
Here is my situation:

I have a dbunit test which is testing my business layer which uses
hibernate. I have 2 hibernate.cfg.xml files, one for the application and one
for tests which basically are the same except the db connection settings. My
issue is that my mappings files (*.hbm.xml files) reside in the application
structure and when launching the test lifecycle the classloader doesn't find
them. By the way, if I put my hbm.xml files under test/resources (and thus
adapt my hibernate config which I don't want) it works perfectly. But my
goal is to let those hbm.xml files under the application structure without
touching/copying them for testing purposes.

Can you help me?

Valentin Jacquemin

Re: Loading hbm files under default hierarchy from test hierarchy

by Paul Benedict-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you running your unit tests in Maven? (You can get different
results in Eclipse.) If so, what version of Maven?

On Thu, Oct 22, 2009 at 9:34 AM, Valentin Jacquemin
<jacqueminv@...> wrote:

> Hi all,
> I am building a project architecture and facing an issue with classloading.
> Here is my situation:
>
> I have a dbunit test which is testing my business layer which uses
> hibernate. I have 2 hibernate.cfg.xml files, one for the application and one
> for tests which basically are the same except the db connection settings. My
> issue is that my mappings files (*.hbm.xml files) reside in the application
> structure and when launching the test lifecycle the classloader doesn't find
> them. By the way, if I put my hbm.xml files under test/resources (and thus
> adapt my hibernate config which I don't want) it works perfectly. But my
> goal is to let those hbm.xml files under the application structure without
> touching/copying them for testing purposes.
>
> Can you help me?
>
> Valentin Jacquemin
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...