Configuring SEAM test with junit
jxerxes Mar 21, 2006 4:47 AMHi to everybody and thanks for the big job you have done!
i know that i am asking a silly question...
i need some help with my first SEAM app.
i already have a working app with a sybase ASA9 database.
i'm using seam beta 1 and jboss 4.0.3SP1 without ejb rc4.
works fine. i want to wait till everything is final until i migrate.
now i want to write a test with junit. my problem is that i cant get the configuration into the entitymanagerfactory. the code looks like this:
EntityManagerFactory emf; ... emf = Persistence.createEntityManagerFactory("test");
persistence.xml looks like:
<entity-manager> <name> test </name> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.SybaseAnywhereDialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.connection.driver_class" value="com.sybase.jdbc2.jdbc.SybDriver"/> <property name="hibernate.connection.username" value="..."/> <property name="hibernate.connection.password" value="..."/> <property name="hibernate.connection.url" value="jdbc:sybase:Tds:localhost:same as in my app"/> <property name="hibernate.max_fetch_depth" value="3"/> </properties> </entity-manager>
i have also tried
<persistence> <persistence-unit name="test" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.SybaseAnywhereDialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.connection.driver_class" value="com.sybase.jdbc2.jdbc.SybDriver"/> <property name="hibernate.connection.username" value="..."/> <property name="hibernate.connection.password" value="..."/> <property name="hibernate.connection.url" value="jdbc:sybase:Tds:same as in my app"/> <property name="hibernate.max_fetch_depth" value="3"/> </properties> </persistence-unit> </persistence>
or the programmatic way:
HashMap map = new HashMap(); map.put("hibernate.connection.driver_class", "com.sybase.jdbc2.jdbc.SybDriver"); map.put("hibernate.connection.url", "jdbc:sybase:Tds:localhost:same as in my app"); map.put("hibernate.connection.username", "..."); map.put("hibernate.connection.password", "..."); emf = Persistence.createEntityManagerFactory("test",map);
it always goes as far as:
21.03.2006 10:33:09 org.hibernate.cfg.Environment <clinit> INFO: Hibernate 3.1 21.03.2006 10:33:09 org.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found 21.03.2006 10:33:09 org.hibernate.cfg.Environment <clinit> INFO: using CGLIB reflection optimizer 21.03.2006 10:33:09 org.hibernate.cfg.Environment <clinit> INFO: using JDK 1.4 java.sql.Timestamp handling
and then i get a persistenceException: no provider for entity manager named test.
please help me, i don't know what i have forgotten...