JBoss Community

jBPM3 with JPA2 (+Spring3, JBoss 4.2.3)

created by Maciej Zerkowski in jBPM - View the full discussion

 

<!jBPM3 with JPA2 (+Spring3, JBoss 4.2.3)><xml> <o:OfficeDocumentSettings>   <o:RelyOnVML />   <o:AllowPNG />   <o:DoNotRelyOnCSS /> </o:OfficeDocumentSettings> </xml><![endif]><!jBPM3 with JPA2 (+Spring3, JBoss 4.2.3)><xml> <w:WordDocument>   <w:View>Normal</w:View>   <w:Zoom>0</w:Zoom>   <w:PunctuationKerning />   <w:ValidateAgainstSchemas />   <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>   <w:IgnoreMixedContent>false</w:IgnoreMixedContent>   <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>   <w:Compatibility>    <w:BreakWrappedTables />    <w:SnapToGridInCell />    <w:WrapTextWithPunct />    <w:UseAsianBreakRules />    <w:DontGrowAutofit />    <w:UseFELayout />   </w:Compatibility>   <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]><!jBPM3 with JPA2 (+Spring3, JBoss 4.2.3)><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]><!jBPM3 with JPA2 (+Spring3, JBoss 4.2.3)> <mce:style><!   /* Style Definitions */  table.MsoNormalTable      {mso-style-name:"Table Normal";      mso-tstyle-rowband-size:0;      mso-tstyle-colband-size:0;      mso-style-noshow:yes;      mso-style-parent:"";      mso-padding-alt:0cm 5.4pt 0cm 5.4pt;      mso-para-margin:0cm;      mso-para-margin-bottom:.0001pt;      mso-pagination:widow-orphan;      font-size:10.0pt;      font-family:"Times New Roman";      mso-ansi-language:#0400;      mso-fareast-language:#0400;      mso-bidi-language:#0400;}  ></mce:style><mce:style  mcebogus="1"><!>

-->

<!jBPM3 with JPA2 (+Spring3, JBoss 4.2.3)>

Hello all!




I have a question regarding configuration jBPM 3.2.6.SP1 with JPA2 (Hibernate implementation). I am new in jBPM and I would like to ask you how can I do that in a proper way? You can find my configuration bellow.


 


What I would also like to know is – what in your opinion is the best approach to integrate jBPM with the web application (like in my case) - to integrate my persistent classes with the jBPM persistent classes and have one entity manager factory (hibernate session factory) or to use two data sources and synchronize transactions somehow.


 


Can you give me some examples or links or maybe you have some tips or suggestions what is the best way (and how) to do this?


 


I appreciate any help.


 


Regards,


Maciek


 


 

my applicationContext.xml:


 


<bean id="dataSource" class="org.springframework.


jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/db" />
</bean>


 


<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="database">...</prop>
...
</props>
</property>
</bean>


 


<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>


 


<tx:annotation-driven transaction-manager="transactionManager" />


 


 


 

my persistence.xml:


 


<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<class>com.myDVDStore...</class>
...
</persistence-unit>


 


my

<span style="color: #333333;">jbpm.cfg.xml:</span>


 


<jbpm-context>
<service name="authentication"
factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory"
/>
<service name="logging"
factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
<service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
<service name="persistence">
<factory>
<bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory"> // I probably need to extend this to put my service there?
<field name="isTransactionEnabled">
<false />
</field>
</bean>
</factory>
</service>
<service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
<service name="scheduler"
factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
</jbpm-context>


 


 


<bean id="dataSource" class="org.springframework.

jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/db" />
</bean>

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceXmlLocation"
value="classpath:META-INF/persistence.xml" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="database">...</prop>
...
</props>
</property>
</bean>

<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>

my persistence.xml:

<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<class>...</class>
...
</persistence-unit>

my jbpm.cfg.xml

<jbpm-context>
<service name="authentication"
factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory"
/>
<service name="logging"
factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
<service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
<service name="persistence">
<factory>
<bean class="com.myapp.JpaDbPersistenceServiceFactory"> // I
probably need to extend this to put my service there?
<field name="isTransactionEnabled">
<false />
</field>
</bean>
</factory>
</service>
<service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
<service name="scheduler"
factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
</jbpm-context>

<tx:annotation-driven transaction-manager="transactionManager" />


 

Reply to this message by going to Community

Start a new discussion in jBPM at Community