I'm sure I'm being an idiot on this, but I'm trying to get a unit test working
with an EntityManagerFactory (as per the Seam reference) but I can't get it to find my
persistence.xml.
The error I am getting is:
INFO 29-10 12:13:49,503 [org.hibernate.ejb.Version.<clinit>():15] Hibernate
EntityManager 3.2.0.GA
| INFO 29-10 12:13:49,524 [org.hibernate.cfg.annotations.Version.<clinit>():15]
Hibernate Annotations 3.2.0.GA
| INFO 29-10 12:13:49,534 [org.hibernate.cfg.Environment.<clinit>():500]
Hibernate 3.2.1
| INFO 29-10 12:13:49,541 [org.hibernate.cfg.Environment.<clinit>():533]
hibernate.properties not found
| INFO 29-10 12:13:49,543 [org.hibernate.cfg.Environment.buildBytecodeProvider():667]
Bytecode provider name : cglib
| INFO 29-10 12:13:49,549 [org.hibernate.cfg.Environment.<clinit>():584] using
JDK 1.4 java.sql.Timestamp handling
| INFO 29-10 12:13:49,632 [org.hibernate.ejb.Ejb3Configuration.configure():202] Could
not find any META-INF/persistence.xml file in the classpath
| WARN 29-10 12:13:49,679
[org.hibernate.connection.UserSuppliedConnectionProvider.configure():23] No connection
properties specified - the user must supply JDBC connections
| FAILED CONFIGURATION: @BeforeTest init
| javax.persistence.PersistenceException: org.hibernate.HibernateException: Hibernate
Dialect must be explicitly set
| at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
| at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
| at com.locuslive.odyssey.test.TestUnLocodeList.init(TestUnLocodeList.java:36)
| Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
| at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
| at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
| at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:409)
| at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:119)
| at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)
| at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
| ... 23 more
It's a standard Seam Gen'd project with 3 persistence.xmls (dev, test, prod) in
the resources/META-INF directory. I've added the 4 test jars
(lib/test/jboss-embedded-all.jar, lib/test/hibernate-all.jar, lib/test/thirdparty-all.jar
and lib/test/jboss-deployers.jar) to the top of the TestNG User classpath.
I've seen in some other posts that people have had success moving the persistence.xml
file around. This hasn't worked for me.
My persistence.xml looks like this:
| <?xml version="1.0" encoding="UTF-8"?>
| <!-- Persistence deployment descriptor for dev profile -->
| <persistence
xmlns="http://java.sun.com/xml/ns/persistence"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
| <persistence-unit name="Odyssey0.5.0">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/Odyssey0.5.0Datasource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto"
value="validate"/>
| <property name="hibernate.cache.use_query_cache"
value="true"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="jboss.entity.manager.factory.jndi.name"
value="java:/Odyssey0.5.0EntityManagerFactory"/>
| </properties>
| </persistence-unit>
| </persistence>
|
Can anyone suggest a solution? Am I missing something obvious?
Thanks,
Damian.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099818#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...