Hi Tawus, this is a bit different story because Hibernate doesn't scan the classpath. As a Hibernate user you need to configure your entities manually. So, you would never expect the entities to be added automatically. Obviously, JPA users do. But I still think that in case of multiple persistence units no classpath scanning should happen.
Thank you On Wed, Jul 13, 2011 at 2:34 AM, Taha Hafeez <[email protected]>wrote: > Hi Igor > > I have a multiple-database support for hibernate in tawus-core. What I do > to > handle this situation is to allow users to specify a configuration for each > sessionfactory and that configuration takes a list of package names as > argument. The SessionFactorySource creates a SessionFactory for each > configuration, scans the given packages, adds the classes in the given > package names to the session factory. > > > https://github.com/tawus/tawus/blob/master/tawus-hibernate/src/main/java/com/googlecode/tawus/hibernate/internal/services/SessionFactorySourceImpl.java > > > https://github.com/tawus/tawus/blob/master/tawus-hibernate/src/main/java/com/googlecode/tawus/hibernate/services/SessionFactoryConfiguration.java > > Which classes to add can be setup by a filter > > regards > Taha > > > On Wed, Jul 13, 2011 at 2:30 AM, Lenny Primak <[email protected] > >wrote: > > > Since I was the 'victim' of all of this, and worked through a solution, > > My suggestion wold be to contribute some sort of a configuration map > > of persistence units to package names, maybe a one-line of code, > > an annotation of some sort. > > > > On Jul 12, 2011, at 4:56 PM, Igor Drobiazko wrote: > > > > > The recent discussion on the user's list on JPA integration is quite > > > interesting. The question is whether Tapestry should automatically add > > > entities found anywhere on the classpath to the EntityManagers. Here is > > the > > > link to the discussion: > > > > > > http://markmail.org/message/wb3iu3adpotbephh > > > > > > Currently it works as: > > > > > > 1) if there is only a single persistence unit configured, only entities > > from > > > app's entities package are automatically added to the EntityManager. > This > > > conforms to behavior of the Hibenrate library and works out of the box. > > > However, this conflicts with the JPA specification in some way. JPA > > > specification says that <exclude-unlisted-classes> controls whether > > > auto-scanning should be done or not. Currently, this element is ignored > > in > > > Tapestry. > > > > > > 2) If multiple persistence units are configured, no auto-scanning > > happens. > > > None of the entities is added to any EntityManager. When discovering an > > > entity class on the classpath, Tapestry can't know to which > EntityManager > > it > > > belongs. It also doesn't make sense to add all the entities to all the > > > EntityManagers. So, when using multiple persistence unit, the user > needs > > to > > > add the entities explicitly. > > > > > > Any feedback? Ideas? > > > > > > -- > > > Best regards, > > > > > > Igor Drobiazko > > > http://tapestry5.de > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > -- Best regards, Igor Drobiazko http://tapestry5.de
