I do have an issue concerning persistence unit test with JPA.
I got an No Persistence provider for EntityManager named exception when I am running my JUnit tests. I follow the advices from this post No Persistence provider for EntityManager named but nothing seems working.
I run my unit test out of my JBOSS Application Server.
I get my EntityManager with this piece of code
final String PERSISTENCE_UNIT_TEST = "RFIDPeopleProtoPersistenceTest";
public PersonDAOTest( ) throws Exception{
try{
this.personDAO = new PersonDAO( );
EntityManagerFactory factory = Persistence.createEntityManagerFactory( PERSISTENCE_UNIT_TEST );
EntityManager em = factory.createEntityManager();
dao.setEntityManager( em );
}catch( Exception e ){
...
}
}
I had the hibernate-entitymanger.jar in my maven project (pom.xml)
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.18.Final-redhat-2</version>
<scope>test</scope>
</dependency>
I had the in my persistence specification file (test-persistence.xml) for my test
<persistence-unit name="RFIDPeopleProtoPersistenceTest" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/rfidpeopleProtoTestDS</jta-data-source>
<class>org.rfidpeople.prototype.model.AbstractContactInfo</class>
<properties>
<property name="connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="connection.url" value="jdbc:jtds:sqlserver://localhost:1433/RFIDPeople" />
<property name="connection.username" value="sa" />
<property name="connection.password" value="sa1234" />
<property name="dialect" value="org.hibernate.dialect.SQLServerDialect" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
</properties>
I have this file system in my eclipse JBOSS developer studio
I am currently out of solutions to find my problem.
I bit help will be appreciated.