-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to set SessionFactoryInterceptor with EJB3/JBoss?
PostPosted: Tue Sep 19, 2006 1:54 pm 
Newbie

Joined: Tue Sep 12, 2006 7:03 am
Posts: 7
Location: Berlin
Hi,

what would be the best way to set a hibernate SessionFactoryInterceptor when using ejb3 entity beans rather than native hibernate services?

I'm using JBoss AS 4.0.4 GA Patch1 with hibernate3 and ejb3 persistence. For native hibernate services, JBoss reads the interceptor from hibernate-service.xml:

Code:
<mbean code="org.jboss.hibernate.jmx.Hibernate"
       name="jboss.har:service=Hibernate">
    <attribute name="DatasourceName">java:/DefaultDS</attribute>
    <attribute name="Dialect">net.sf.hibernate.dialect.HSQLDialect</attribute>
    <attribute name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
    <attribute name="SessionFactoryInterceptor">my.InterceptorImpl</attribute>

    <attribute name="CacheProviderClass">
        net.sf.hibernate.cache.HashtableCacheProvider
    </attribute>
</mbean>


For ejb3 persistence, the persistence.xml file looks pretty similar, except there is no property for the SessionFactoryInterceptor that I would know of.

Code:
<persistence>
   <persistence-unit name="manager1">
       <jta-data-source>java:/DefaultDS</jta-data-source>
       <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
       </properties>
   </persistence-unit>
</persistence>



Fritz

_________________
His Darkness and His Brightness
exchanged greetings of extreme politeness


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 4:08 pm 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Look at the HEM docs.
They cover Hibernate interceptors at ejb3 level - set as property.


Top
 Profile  
 
 Post subject: JBoss EJB 3.0 and Hibernate MBean Doku
PostPosted: Wed Sep 20, 2006 4:43 am 
Newbie

Joined: Tue Sep 12, 2006 7:03 am
Posts: 7
Location: Berlin
Hey, thank you. Wonder why I didn't see this earlier, The property is missing in the JBoss server and Hibernate MBean Doku.

Any way, this works:

Code:
<persistence>
   <persistence-unit name="usermodel">
       <jta-data-source>java:/xDS</jta-data-source>
       <properties>
              <property name="hibernate.ejb.interceptor"          value="my.SessionFactoryInterceptor" />
       </properties>
   </persistence-unit>
</persistence>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.