[hibernate-issues] [Hibernate-JIRA] Commented: (EJB-252) Persistence.xml <class> entity does not allow package name to be specified (documentation says it does)

Kenneth Roe (JIRA) noreply at atlassian.com
Fri Dec 1 16:39:04 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-252?page=comments#action_25539 ] 

Kenneth Roe commented on EJB-252:
---------------------------------

No, as you suspected I took it to mean classes within the package would be mapped.  

Two suggestions:

1.) Clarify this behavior in the documentation - an example of how it could be used would be great.

2.) The stack trace doesn't make the problem obvious.  If the package is found, but does not have package-info.java could the message for the exception say that packge-info.java was expected but not found in the package?

Example stack trace:

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: EPanOrderEdit] class or package not found
	at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1067)
	at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:864)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:750)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:178)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:235)
	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
                     <portion of stack trace removed>

Caused by: java.lang.ClassNotFoundException: com.surveysampling.emailpanel.geo
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:112)
	at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:983)
	at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1055)
	... 17 more

Thanks for looking into this,
-Ken


> Persistence.xml <class> entity does not allow package name to be specified (documentation says it does)
> -------------------------------------------------------------------------------------------------------
>
>          Key: EJB-252
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-252
>      Project: Hibernate Entity Manager
>         Type: Bug

>   Components: EntityManager
>     Versions: 3.2.0.ga
>  Environment: 3.2.0, Oracle 9i r2
>     Reporter: Kenneth Roe

>
>
> The EntityManager reference documentation indicates that you can specify a package name in the <class> element of persistence.xml.  This does not appear to be the case.
> Section of the documentation that says package names will work: 
> "The class element specifies a fully qualified class name that you will map. By default all properly annotated classes and all hbm.xml files found inside the archive are added to the persistence unit configuration. You can add some external entity through the class element though. As an extension to the specification, you can add a package name in the <class> element (eg <class>org.hibernate.eg</class>)."

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list