tags:

views:

239

answers:

3

Hi,

Seeing as the hibernate.cfg.xml file has to be in the running application (in this case a web application), what is the best way to have the file in both my test project and my web app project?

A: 

The easiest way is to just put a copy of the XML file in both projects. You'll just have to be careful to keep all the configuration settings in synch in both places. This will allow for easy debugging within the test project or web app. If you have a build system setup, which creates deployments for testing, you could store the xml file in a common location, then create a build action to copy it to the output directory of both projects when you go to deploy/test.

Andy White
+1  A: 

I'd suggest that you place the xml file into a seperate directory and link/share the file. You can refer to DimeCasts.net for more information. www.dimecasts.net/Casts/CastDetails/10

Kane
+1  A: 

You can add the file to multiple projects. If you use visual studio you can right click one of the projects and than add existing item. Click on the arrow on the right of the add button. Click on "add as link" The same file is added to both the projects now.

I don't recommend to use the same database for automatic tests, because the tests will run slow and it will be difficult to ensure the state of the database before each test.

Paco