12-18-2012 10:14 AM
class Person implements Serializable{
private String id, firstName, lastName;
//setters & getters
}
class PersonDelegate{
private Person realPerson;
private String id;
private void writeObject(java.io.ObjectOutputStream out) throws IOException{
out.writeBytes(id);
}
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException{
id = in.readLine();
}
public String getFirstName(){
loadPerson();
return realPerson.getFirstName();
}
private void loadPerson(){
if(realPerson==null)
realPerson=use_my_service_to_load_person(id);
}
}
<bean id="configurationFactory" class="org.activiti.osgi.blueprint.ConfigurationFactory">
<property name="dataSource" ref="dataSource" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
It does only contain configuration for dataSrouce, it does not contain configuration for JPA. It shouldn't be hard to add JPA to this configuration, but if anyone has already full configuration, I would be greatful I someone posts such configuration with JPA.12-18-2012 12:04 PM
1. Is there a way to create custom serializer for my process variables?
2. How can I store complex process variables as XML documents?
3. If I use JPA will I have my process stored only in my tables instead of ACT_GE_BYTEARRAY as byte array?
4. Any other idea?
5. Can somebody provide me sample Blueprint configuration with JPA (regarding org.activiti.osgi.blueprint.ConfigurationFactory or some other classes).
12-19-2012 05:24 AM
<bean id="configurationFactory" class="org.activiti.osgi.blueprint.ConfigurationFactory">
<property name="dataSource" ref="dataSource" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
<bean id="configuration" factory-ref="configurationFactory" factory-method="getConfiguration" />
ConfigurationFactory instantiates StandaloneProcessEngineConfiguration object.
<bean id="configurationFactory" class="com.asseco.ufe.prototyping.workflow.activiti.ConfigurationFactory">
<property name="dataSource" ref="activitiDS" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
<bean id="configuration" factory-ref="configurationFactory" factory-method="getConfiguration">
<property name="jpaPersistenceUnitName" value="prototypeJPA" />
</bean>
When I added jpaHandleTransaction/jpaCloseEntityManager properties to configuration bean:
<bean id="configuration" factory-ref="configurationFactory" factory-method="getConfiguration">
<property name="jpaPersistenceUnitName" value="prototypeJPA" />
<property name="jpaHandleTransaction" value="true"/>
<property name="jpaCloseEntityManager" value="true"/>
</bean>
Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: No setter for jpaHandleTransaction property
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:940)
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:903)
ProcessEngineConfiguration <- contains setJpaHandleTransaction
^
|
ProcessEngineConfigurationImpl <- contains setJpaHandleTransaction
^
|
StandaloneProcessEngineConfiguration <- does not contain setJpaHandleTransaction
<bean id="configurationFactory" class="com.mc.activiti.MyConfigurationFactory">
<property name="dataSource" ref="activitiDS" />
<property name="databaseSchemaUpdate" value="true"/>
<property name="jpaHandleTransaction" value="true"/>
<property name="jpaCloseEntityManager" value="true"/>
<property name="jpaEntityManagerFactory" ref="myEntityManagerFactory"/>
</bean>
<bean id="configuration" factory-ref="configurationFactory" factory-method="getConfiguration">
</bean>
<reference id="myEntityManagerFactory"
interface="javax.persistence.EntityManagerFactory" filter="osgi.unit.name=myJPA"/>
and here's factory code
public class SecondConfigurationFactory {
private DataSource dataSource;
private String databaseSchemaUpdate;
private boolean jobExecutorActivate = true;
private boolean jpaHandleTransaction;
private boolean jpaCloseEntityManager;
private EntityManagerFactory jpaEntityManagerFactory;
public StandaloneProcessEngineConfiguration getConfiguration() {
StandaloneProcessEngineConfiguration conf =
new StandaloneProcessEngineConfiguration();
conf.setDataSource(dataSource);
conf.setDatabaseSchemaUpdate(databaseSchemaUpdate);
conf.setJobExecutorActivate(jobExecutorActivate);
conf.setJpaEntityManagerFactory(jpaEntityManagerFactory);
conf.setJpaHandleTransaction(jpaHandleTransaction);
conf.setJpaCloseEntityManager(jpaCloseEntityManager);
return conf;
}
//setters for all attributes
}
12-21-2012 03:12 PM
12-23-2012 12:44 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.