Some 'more, in-depth' information on Oracle BPEL PM, ESB and other SOA, day2day things

Thursday, February 24, 2005

Doing work (updates ..) within the commit cycle in BC4J

Some question I encounter more and more from our customers is around the challenge of 'How to deal with Sequences - where we must have no gap in between'.

This problem occurs usually when you read you sequence value, do some business logic, which fails - and then discard your changes - voila the sequence number is gone.

There are certain cases, mostly related to government'l issues, where those guys must ensure to have no gaps in their sequences.

So what about reading your sequence in the very last moment before commit actually happens?

The method postChanges in your EOImpl class is a nice place to but this part of logic, but you have to be careful about, as postchanges could be called more then once during a commit cycle.

So simply overwrite the method
public void postChanges(TransactionEvent e)
// TODO: Override this oracle.jbo.server.EntityImpl method
if (!isCreated)
System.out.println("setting dname");
setDname(getDname() + "xx");
isCreated = true;

and you are through.

Having questions? Feedback me on this entry Doing work (updates ..) within the commit cycle in BC4J


Post a Comment

<< Home