maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane-3 <>
Subject DAO injection in integration tests with a few database server specific methods
Date Fri, 23 Nov 2012 06:15:34 GMT

I have a Spring Hibernate project with a DAO coded against a MySql database.
Most of the DAO methods would run on HSQLDB and on Oracle, except for some
that contain database server specific syntax.

I already use some Maven profiles to filter the database server data source
specific properties.

Now I wonder which way to go so as to have a few DAO methods specific to
each database server.

I would like to keep most of the DAO methods in a common location, and only
have the database server specific DAO methods in anpther one.

So for example, for the Oracle database server:

Should the Oracle specific DAO methods sit in a different Java package ?

Should there be a different resource xml file to have the beans for the
integration tests injection of these specific DAO methods ?

Here is my setup as of today:

The abstract test class:

@ContextConfiguration(locations = { "classpath:spring-hibernate.xml",
"classpath:spring-hibernate-dao.xml", "classpath:spring-data-source.xml",
"classpath:log4j.xml" })
public abstract class AbstractDaoTest extends
AbstractTransactionalJUnit4SpringContextTests {

A Maven profile for the Oracle database server:


The spring-hibernate-dao.xml file content:


	<bean id="addressDao"
		<property name="sessionFactory" ref="sessionFactory" />

	<bean id="adminDao"
		<property name="sessionFactory" ref="sessionFactory" />


View this message in context:
Sent from the Maven - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message