• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

no persistent classes found for query class

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I am excited with Spring and its possibilities. It is a new world for me but I am finding a lot of information about it.

I have tested spring with hibernate creating a jar component. It uses a persistence class called Employee.

INFO #1)


...


I have created a webapp to show the returned records on web and I have used my jar to get the information.

I have deployed it on Jboss and I test it!

I got a suprise, the following exception:

DEBUG 03/12/2008 11:02:19,483] - Opening Hibernate Session
[DEBUG 03/12/2008 11:02:19,527] - opened session at timestamp: 12282985394
[WARN 03/12/2008 11:02:19,536] - no persistent classes found for query class: from es.pml.bp4d.p8_spring.mvc.model.Employee x
[DEBUG 03/12/2008 11:02:19,547] - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
[DEBUG 03/12/2008 11:02:19,549] - Eagerly flushing Hibernate session
[DEBUG 03/12/2008 11:02:19,549] - Closing Hibernate Session


I am confuse because I don't understand why it can't find the persistent class after that the jar test was OK!

I would appreciate any comments about this case and if you need further information, please don't hesitate to ask for it.

Best Regards.
 
Paco Martin Duque
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic