I am developing an application using Smart GWT, Spring & JPA. On the user interface, I have multiple forms which are submitted as single request using RPCManager as shown below:
RPCManager.startQueue();
dynamicForm1.saveData();
dynamicForm2.saveData();
dynamicForm3.saveData();
RPCManager.sendQueue();
Each dynamic form is associated with the SmartGWT datasource. Sample of the datasource is as follows:
<DataSource
beanClassName="com.dialog.vba.server.model.TaxonLifestyle"
ID="TaxonLifestyle_DS"
dataSourceVersion="1"
serverConstructor="com.isomorphic.jpa.JPADataSource"
serverType="hibernate"
>
<fields>
<field title="Active Time of the Day" name="activeTimeOfDayCde" type="text"></field>
<field title="Creation Tsp" name="creationTsp" type="datetime"></field>
<field title="Taxon Diet" name="dietCde" type="text"></field>
<field title="Hollow Dependence" name="hollowDependenceCde" type="text"></field>
<field title="Modified Tsp" name="modifiedTsp" type="datetime"></field>
<field title="Taxon" name="taxon" javaClass="com.dialog.vba.server.model.Taxon" canEdit="true" type="Taxon_DS" multiple="false" ignore="true"></field>
<field title="Taxon Cde" hidden="true" primaryKey="true" name="taxonCde" type="text"></field>
</fields>
<serverObject lookupStyle="spring" bean="taxonDescriptionBo" />
<operationBindings>
<binding operationType="fetch" serverMethod="fetchLifestyle" />
<binding operationType="update" serverMethod="updateLifestyle" />
<binding operationType="add" serverMethod="updateLifestyle" />
</operationBindings>
</DataSource>
As it can be seen in DS, update methods in the bo (service class) will be called.
Hence, in my case, for each dynamic form, an update method in the bo will be called.
The issue I am getting is as follows:
In bo, transaction are managed at each method. Hence, if a single method (say dynamicform3 update method) has exception only that transaction is rolled-back while other bo methods are committed. I do not want this to happen. If any method has an exception, entire transaction should roll-back. i.e. data from all forms should save or no data should be saved to database.
I cannot use ValuesManager as each form has different datasource. In the project, each datasource is mapped to POJO and eventually to a table in the oracle database.
Could you please suggest how it can be done using RPCManager in the above scenario?
RPCManager.startQueue();
dynamicForm1.saveData();
dynamicForm2.saveData();
dynamicForm3.saveData();
RPCManager.sendQueue();
Each dynamic form is associated with the SmartGWT datasource. Sample of the datasource is as follows:
<DataSource
beanClassName="com.dialog.vba.server.model.TaxonLifestyle"
ID="TaxonLifestyle_DS"
dataSourceVersion="1"
serverConstructor="com.isomorphic.jpa.JPADataSource"
serverType="hibernate"
>
<fields>
<field title="Active Time of the Day" name="activeTimeOfDayCde" type="text"></field>
<field title="Creation Tsp" name="creationTsp" type="datetime"></field>
<field title="Taxon Diet" name="dietCde" type="text"></field>
<field title="Hollow Dependence" name="hollowDependenceCde" type="text"></field>
<field title="Modified Tsp" name="modifiedTsp" type="datetime"></field>
<field title="Taxon" name="taxon" javaClass="com.dialog.vba.server.model.Taxon" canEdit="true" type="Taxon_DS" multiple="false" ignore="true"></field>
<field title="Taxon Cde" hidden="true" primaryKey="true" name="taxonCde" type="text"></field>
</fields>
<serverObject lookupStyle="spring" bean="taxonDescriptionBo" />
<operationBindings>
<binding operationType="fetch" serverMethod="fetchLifestyle" />
<binding operationType="update" serverMethod="updateLifestyle" />
<binding operationType="add" serverMethod="updateLifestyle" />
</operationBindings>
</DataSource>
As it can be seen in DS, update methods in the bo (service class) will be called.
Hence, in my case, for each dynamic form, an update method in the bo will be called.
The issue I am getting is as follows:
In bo, transaction are managed at each method. Hence, if a single method (say dynamicform3 update method) has exception only that transaction is rolled-back while other bo methods are committed. I do not want this to happen. If any method has an exception, entire transaction should roll-back. i.e. data from all forms should save or no data should be saved to database.
I cannot use ValuesManager as each form has different datasource. In the project, each datasource is mapped to POJO and eventually to a table in the oracle database.
Could you please suggest how it can be done using RPCManager in the above scenario?
Comment