Hi,I have a couple of questions regarding process variables storage, but the short one is: is there a way to create custom serializer for my process variables?Let me provide some background:- let's say that I use process variables as complex object, for example:
class Person implements Serializable{
private String id, firstName, lastName;
//setters & getters
}
1. I know, that when I use such object then Activiti serializes it using Java Seralization mechanism[/li]2. let's say that in some point in time a developer upgrades such object:2.1 he may add new attribute to object2.2 he may remove attribute2.3 he may rename an attribute (since he make a typo a week ago)3. application is already deployed in production4. I know that process variables for such complex objects are stored as byte array in ACT_GE_BYTEARRAY table. Is there a way to upgrade my objects in that table by some SQL scripts?1. One idea would be to create a proxy object and store only an "id" attribute. Then create readObject/writeObject methods that serialize/deserialize only id attribute. Rest of the attributes would be delegated, for example:
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);
}
}
Then I store only id in Activiti tables and real objects are stored somewhere else where I can manage my structure modification.2. In user guide I found following sentence: "Activiti supports complex Java objects to be stored as process variables like Serializable objects, JPA entities or whole XML documents as Strings."How can I store complex process variables as XML documents?3. Another option is to use JPA support mentioned in 2), but I also want to use OSGi. I've seen, that Activiti supports OSGi, but I only found following configuration from book "Activiti in Action"
<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. So anyway, if I use JPA will I have my objects stored only in my tables instead of ACT_GE_BYTEARRAY as byte array? Summary: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).Thanks in advance for any help.