1.) Glassfish
2.) Postgresql - brand certain that max_transactions is gear upward to at to the lowest degree 10. Otherwise you lot volition run into the no session fault because past times default the value is 0.
3.) Checkout travelexpenses from:
https://svn.camunda.com/fox/demo/activiti-cdi/travelexpenses/trunk/
4.) Modify the next files equally follows:
persistence.xml
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="activitiPU"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <!-- If you lot are running inward a production environment, add together a managed information source, the representative information root is merely for proofs of concept! --> <jta-data-source>activitiDemoDS</jta-data-source> <class>com.camunda.fox.activiti.cdi.example.travelexpenses.domain.Employee</class> <properties> <!-- Properties for Hibernate --> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> <property name="hibernate.connection.<" value="org.postgresql.Driver" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="connection.autocommit" value="true" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="false" /> </properties> </persistence-unit> </persistence>
activiti.cfg.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- activiti configuration for glassfish application server --> <!-- lookup the JTA-Transaction managing director --> <bean id="transactionManager" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:appserver/TransactionManager"></property> <property name="resourceRef" value="true" /> </bean> <!-- procedure engine configuration --> <bean id="processEngineConfiguration" class="org.activiti.cdi.CdiJtaProcessEngineConfiguration"> <property name="dataSourceJndiName" value="activitiDS" /> <property name="transactionManager" ref="transactionManager" /> <property name="transactionsExternallyManaged" value="true" /> <property name="databaseSchemaUpdate" value="true" /> </bean> </beans>
5.) Make certain that you lot accept successfully define the next within Glassfish:
Connection Pools
-activitiPool
-activitiDemo
Pool JDBC Connection
-activitiDS
-activitiDemoDS
6.) Since nosotros accept two PersistenceContext, inward AuthenticationBean brand certain that you lot specify unitName when injecting entity manager:
@PersistenceContext(unitName = "activitiPU")
soul EntityManager entityManager;
0 komentar:
Please comment if there are any that need to be asked.