Hi everyone,
At the end when I am going to throw the towel , I said to me : come on, the solution is close.
I refresh us the problem:
- I created a jar with spring and hibernate.
- I created a webapp and using my jar to get the service.
The test on my jar was OK.
The test on my war was not OK. I deployed my war on JBOSS.
The message was:
"no persistent classes found for query class ..."
Well,
the solution is in the dependecies or better in the scope of the dependencies.
My pom.xml was :
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
<scope>compile</scope>
</dependency>
<!-- Spring MVC Framework -->
<dependency>
<groupId>spring</groupId>
<artifactId>spring-webmvc</artifactId>
<version>2.5.6</version>
<scope>compile</scope>
</dependency>
<!-- Hibernate Framework -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.1.GA</version>
<!-- <scope>compile</scope> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
And as the same as the hibernate dependencies must have the provided scope due to JBOSS distribution has these components , the "javax.persistence" must have the provided scope.
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<scope>provided</scope> </dependency>
And with this change, the WAR works OK!
Best Regards