cancel
Showing results for 
Search instead for 
Did you mean: 

Process variable issue in domain classes where one to one relation exists

srikanthkollipa
Champ in-the-making
Champ in-the-making
Hi,

I have a form where user enters the information while raising a request. This information will be stored in multiple tables.

Parent Domain – RequestDetails
Child – RequestAttributes
Child – RequestStipulations


The relation is RequestDetails to RequestAttributes is one-to-one.
For RequestDetails–Request stipulataions is one-to-many.

My bpmn file looks like:

<blockcode>
<process id="sampleRequest" name="Sample Request">
        <startEvent id="start" />
        <sequenceFlow id="flow0" targetRef="submitWorkflowRequest"
                      sourceRef="start" />
        <userTask id="submitWorkflowRequest" activiti:formKey="/SampleRequest/create"
                  name="Submit Workflow Request">
            <documentation>Workflow request submitted by ${username}</documentation>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>user(${username})</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>

        </userTask>

        <sequenceFlow id="flow1" targetRef="handleWorkflowRequest"
                      sourceRef="submitWorkflowRequest" />
        <userTask id="handleWorkflowRequest" activiti:formKey="/SampleRequest/approval"
                  name="Handle Workflow Request">
            <documentation>Workflow request submitted by ${username}</documentation>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>user(tenantManager)</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>
        </userTask>

        <sequenceFlow id="flow2" targetRef="end0"
                      sourceRef="handleWorkflowRequest">
        </sequenceFlow>
        <endEvent id="end0" />
</blockcode>

Now when user enters data on the create form and clicks on complete button to submit the request. I am calling the below snippet:

<blockcode>
if (RequestDetailsInstance.save(flush: true, failOnError: true)) {
            flash.message = "Request ${RequestDetailsInstance.id} created"

            params.id = RequestDetailsInstance.id
            if (params.complete) {
                completeTask(params)
                render "Request created with id:  ${RequestDetailsInstance.id} "

            }else {
                saveTask(params)
                render "Request saved with id:  ${RequestDetailsInstance.id} "
            }
</blockcode>

It is succesfully saving the data into all the 3 tables by following the relationships among them.
when the control comes to completeTask(params), it is throwing an exception saying, could not find a variable type to serialize [here it is showing the child domain class object variables].

Can anyone help me in resolving this.
12 REPLIES 12

jbarrez
Star Contributor
Star Contributor
"could not find a variable type to serialize "

Means that you try to store something of a type that Activiti does not know how to store. What is this 'child domain' class you are talking about? Does it need to live as a process var in Activiti or is just storing the ids enough?

Thanks for the reply. Here the child domain class is 'RequestAttributes' which is having 4 variables like requestType(string), noOfSamples(long), referenceId(long), comments(string).

Parent class has one to one relationship with this child class.

Parent class has few more attributes like personName (string), personId(long) and personRole(long).

trademak
Star Contributor
Star Contributor
Do your classes implement the Serializable interface?

Best regards,

Yes. Both the parent and child domain classes implemented the Serializable interface. Still got the same error.

I am still stuck with this error… Can anyone provide some help on this?

vasile_dirla
Star Contributor
Star Contributor
please upload here a file with the error you see in the log. (pay attention to be long enough in order to have relevant information)
What Activiti version are you using ?

Thanks for the response.
I am using the grails activiti plugin of version 5.12.1 which is the latest one.

Attached the error log file and the domain classes.

RequestDetails is the parent domain class.
BiosampleAttributes and RequestStipulations are the child domain classes.

RequestDetails can have one BiosampleAttributes class (one to one).
RequestDetails can have many RequestStipulations class (one to many).

Please let me know if any other information is needed.

jbarrez
Star Contributor
Star Contributor
> I am using the grails activiti plugin of version 5.12.1 which is the latest one.

The Grails plugin has not been developed anymore (isn't from us too). I'd really advise to move to the latest version. 5.12 is really old.

vasile_dirla
Star Contributor
Star Contributor
is your custom type registered into the engine configuration?

try to debug into this method:
<code>
public VariableType findVariableType(Object value) {
    for (VariableType type : typesList) {
      if (type.isAbleToStore(value)) {
        return type;
      }
    }
    throw new ActivitiException("couldn't find a variable type that is able to serialize " + value);
  }
</code>

make sure your expected type is into the *typesList* collection.