1 Reply Latest reply: Jan 12, 2012 11:49 AM by Prasad Deshpande RSS

    automatic entity scanning in hibernate 4/JBoss AS 7.1

    Peter Fry Newbie

      Can anyone provide some clarification around automatic entity scanning in Hibernate 4 / JBoss AS 7.1 CR1b?

       

      I am getting stack traces containing

       

      java.lang.IllegalArgumentException: Unknown entity:

       

      By searching on the web you get

       

      http://stackoverflow.com/questions/7339331/hibernate-4-jboss-as-7-cant-auto-detect-entity-and-insert-into-persistenceuni

       

      http://stackoverflow.com/questions/4939732/how-to-auto-register-entities-with-jpa-hibernate-unknown-entity

       

      http://stackoverflow.com/questions/6853112/spring-3-0-5-hierbnate-3-6-6-final-jboss-as-7-database-access

       

      The last question suggests the work around

       

      You need to list the classes you want to map with the EntityManager with a <class> element.

       

      So is it a bug or do I really have to manually specify each and every entity class in my persistence.xml file even though the entity classes are packaged in a persistence jar file which also has the persistence.xml file in it located in the META-INF directory?

       

      Simlar to the experiences of the people asking questions stackoverflow,  it worked previously (Hibernate 3.3 in JBoss 5.0.1).

       

      Thanks,

       

      Peter.