Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

UnitOfWork.unregisterObject does not work

189733Nov 9 2003
The unit of work does not unregister the object.Toplink version is 9.0.3
It tries to insert the unregistered object also.
The scenario is as follows .
1) acquire unit of work
2) register objects
3) One of the registered objects has a attribute that is mapped to a db field varchar(40) but the value in the object is of length 100 .So oracle will throw an exception
4) invoke commitAndResumeOnFailure() on the unit of work
5) catch the exception
6) unregister the problem causing clone.
7) call commit() again.

The unitofwork again tries to insert the unregistered object and fails.

Am I doing some thing wrong.

Code snippet

UnitOfWork uow=server.acquireUnitOfWork();
uow.registerObject(obj1);
obj2Clone=uow.registerObject(obj2); //This object has a attribute that is too long so oracle will throw ORA-01401 exception
try
{
uow.commitAndResumeOnFailure();
}
catch(Exception e)
{
//Since i know which object is causing the problem I unregister that object
// in the actual case i get the query and find the object that is causing the problem.
uow.unregisterObject(obj2Clone);

}
try
{
uow.commit();
}
catch(Exception e)
{
e.printStackTrace();
//Exception thrown ,b'cos the uow tries to insert the obj2( which was already unregistered)and fails.
}

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 7 2003
Added on Nov 9 2003
0 comments
138 views