[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: AbstractEntityManagerImpl.persist in Embeddable EJB 3.0

christophe.laumond do-not-reply at jboss.com
Thu Sep 14 03:19:04 EDT 2006


Thanks to Xavier Hanin which has given me the answer through his website :
https://izvin.bountysource.com/news/show/98 
anonymous wrote : 
  | hibernate entity manager only scans the classes found in the same ?jar? as the persistence.xml. Since my entity classes are in the common project and my persistence.xml in my desktop project (I will have a different one for my shared service project later), it doesn?t find my entities. So I should either add a jar-file entry to my persistence.xml, but this isn?t really possible for an app deployed on the client by the user. So I?ll have to list my entities here. Mmm, I don?t like that. Fortunately, hibernate offers an extension to the specification and let specify a whole package instead of a single class. Fine, let?s use that feature, I?ll do spec compliant stuff when I?ll want to deploy on another EJB3 container :-)
  | 


and thanks to the JBoss team for the good documentation :
http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html_single/index.html

anonymous wrote : 
  | 
  |    <persistence-unit name="manager1">
  |        <jta-data-source>java:/DefaultDS</jta-data-source>
  |        <jar-file>../MyApp.jar</jar-file>
  | ...
  | 

anonymous wrote : 
  | jar-file and class
  | The class element specifies a fully qualified classname that you will belong to the persistence unit. The jar-file element specifies another jar you want automatically scanned for @Entity classes. When using jar-file, you must specify a path relative to the jar file the persistence.xml file is in. By default also, the jar the persistence.xml file is placed in is scanned for @Entity classes as well. 
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971479#3971479

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971479



More information about the jboss-user mailing list