>>2) How should I use the mapResources property?  You currently have the
>>resources loaded on the first access to SessionFactoryStub.openSession.
>>This means it's likely running in a different class loader than the MBean.
>>So if I try to put the mapping file in the server configuration directory
>>("file:../conf/catalina/mapping.hbm.xml"), Hibernate can't find it,
because
>>it's not in the classpath of the first EJB that accesses it (but it is in
>>the classpath of the MBean).  Aren't class loaders fun?
>
>What I had intended to happen here is that you deploy the persistent
>classes and mapping files in the EJB jar (rather than in the MBean
>classpath). Thats the whole point of the SessionFactoryStub class .... to
>ensure that mappings are loaded + compiled using the EJB classloader.
>
>Does it work? If not we might have to rethink this approach.

When I first built a JMX bean, I was trying out the approach of one mapping
file that contains all the mappings (I was using Castor previously).  It
makes sense in that context since you can build the one session factory at
startup and just use the same one throughout the application.  I've switched
to the one mapping per class strategy (that seems to be the prefered way to
use Hibernate) and the whole JMX bean thing doesn't make as much sense with
that approach.  I now just build a static SessionFactory in my data access
object for only the classes which that DAO uses and don't bother with a
SessionFactory bound in JNDI.

So I would suggest the JMX bean is not needed if the prefered way of using
Hibernate is one mapping file per class.  And I would suggest it should be
discourged since it's adding an additional place that needs to be updated
when ever you add/remove a class from an EJB jar (that being the jboss.jcml
file to setup the session factories).

What do you think?

Thanks,
John  


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to