-
1. Re: unit tests in a seam-genned app
gavin.king Feb 3, 2007 3:19 PM (in response to matt.drees)I think this was a bug in 1.1.1 that is fixed in 1.1.5.
-
2. Re: unit tests in a seam-genned app
matt.drees Feb 3, 2007 7:56 PM (in response to matt.drees)I was running from cvs head, so I'm assuming everything in 1.1.5 is in my copy.
But I also tried 1.1.5; same behavior. -
3. Re: unit tests in a seam-genned app
gavin.king Feb 3, 2007 10:16 PM (in response to matt.drees)Oh I didnt read properly. The reason for the error is that the persistence.xml file is using a JTA datasource, which of course does not exist in a unit test. You need a different persistence.xml if you want to run in a unit test.
-
4. Re: unit tests in a seam-genned app
matt.drees Feb 4, 2007 1:24 AM (in response to matt.drees)Ok, thanks.
I'm not sure that any of the examples show how to set up a non-JTA datasource; do they? Is there somewhere else I learn how to do this?
Thanks -
5. Re: unit tests in a seam-genned app
gavin.king Feb 4, 2007 1:38 AM (in response to matt.drees)Check the HEM docs.
-
6. Re: unit tests in a seam-genned app
matt.drees Feb 4, 2007 2:49 AM (in response to matt.drees)Thanks.
From the HEM docs, I put this together:<persistence-unit name="bookingLocal" transaction-type="RESOURCE_LOCAL"> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/> <property name="hibernate.connection.username" value="sa"/> <property name="hibernate.connection.password" value=""/> <property name="hibernate.connection.url" value="jdbc:hsqldb:."/> <property name="hibernate.max_fetch_depth" value="3"/> </properties> </persistence-unit>
I was still getting the NoClassDefFoundError for CacheException, though. So I just grabbed the jar from hibernate core (downloaded separately) and put it in lib. Then it ran fine. -
7. Re: unit tests in a seam-genned app
clivehackney Feb 13, 2007 4:33 AM (in response to matt.drees)Matt,
I was having the same issue, but I fixed it buy adding the following line to the none jta datasource you set up.<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
so your booking local source should read.<persistence-unit name="bookingLocal" transaction-type="RESOURCE_LOCAL"> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/> <property name="hibernate.connection.username" value="sa"/> <property name="hibernate.connection.password" value=""/> <property name="hibernate.connection.url" value="jdbc:hsqldb:."/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" /> </properties> </persistence-unit>
I went back and tried the original persistence-test.xml file, which I added the above line to, this also fixed the tests. It appears the the bootstrap bean in the jboss-beans.xml dosn't pick this up.
my persistence-test.xml now reads.<persistence-unit name="bookings"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/bookingsTestDatasource</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/bookingsEntityManagerFactory"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" /> </properties> </persistence-unit>
Hope that makes some sense.
Clive -
8. Re: unit tests in a seam-genned app
matt.drees Feb 13, 2007 1:38 PM (in response to matt.drees)Cool. Thanks Clive.