|
I have the following
update SQL statement: update
DOMAIN_OBJECT_TBL set SEQUENCE=SEQUENCE+1 where ID=#id# Is it possible to have iBatis update
the domain object, MyDomainObject, after executing this
operation? For instance, I would like to have
code that gives the following: //domain object's sequence is 1 myDomainObjectDao.incrementSequence(myDomainObject); // domain object 's sequence is now 2 Integer sequence = new Integer(myDomainObject.getSequence()); //sequence is 2
However, the code currently does the following because the domain object was not updated to reflect to the database update. //domain object's sequence is 1 myDomainObjectDao.incrementSequence(myDomainObject); // domain object 's sequence is still 1 Integer sequence = new Integer(myDomainObject.getSequence()); //sequence is 1
I have the following statement
sqlMap <sqlMap> <typeAlias type="com.example.MyDomainObject" alias="myDomainObject"/> <resultMap
class="MyDomainObject" id="result"> <result property="id"
column="ID" /> <result property="sequence" column="SEQUENCE"
/> </resultMap> <update id="incrementSequence"
parameterClass="myDomainObject"> update DOMAIN_OBJECT_TBL set
SEQUENCE=SEQUENCE+1 where ID=#id# </update> </sqlMap> |
- update database followed by DO update James Johnson
- Re: update database followed by DO update Brandon Goodin
