Subject: [eclipselink-users] Getting a
database connection withEntityManagerImpl
I'm using DbUnit with EclipseLink for unit testing. I sent an email to
the DbUnit mailing list wondering if there was a easier way to get a database
connection using the information included in a persistence.xml file. Julien
Tabouret replied with a hint on the method EntityManager.getDelegate(). His
example (see below) uses Hibernate.
I was wondering if DBUnit has some facilities to integrate a
persistence.xml file. In the persistence.xml file file there is
already the JDBC Driver, the connection URL to the database, login, pwd...
everthing needed to connect to a DB. What I'm doing at the moment is
duplicating this information into my code sych as :
it would be nice just to have new
DatabaseConnection("persistence.xml"). Because the properties change
depending on the prodiver, we could also have something like w DatabaseConnection("persistence.xml", ORACLE).