[jboss-user] [jBPM] - JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

Stefano Campanini do-not-reply at jboss.com
Tue Apr 27 10:07:31 EDT 2010

Stefano Campanini [http://community.jboss.org/people/campa] replied to the discussion

"JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids"

To view the discussion, visit: http://community.jboss.org/message/539800#539800

Hi guys, I'm back ... with new energies :-)

The problem was related to
org.jbpm.pvm.internal.id.DatabaseDbidGenerator and precisely on AcquireDbidBlockCmd it use.
I have re-implmented these classes using sequence to generate ids, as below:
public class SequenceDbIdGenerator extends DbidGenerator {    
    CommandService commandService;
    public long getNextId() {
        return commandService.execute(new SequenceDbIdGeneratorCmd());
public class SequenceDbIdGeneratorCmd implements Command<Long> {
    private static final long serialVersionUID = -8109570788517494372L;

    public Long execute(Environment environment) throws Exception {
        Session session = environment.get(Session.class);
        List<BigInteger> res = session.createSQLQuery(
                "select nextval('jbpm_seq_external_id')").list();
        return res.get(0).longValue();
and i the jbpm config file:
<object class="net.tinvention.wf.jbpm.SequenceDbIdGenerator">
 <field name="commandService"><ref object="txRequiredCommandService" /></field>
<object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />

Does anyone more expert on jbpm can validate ? Do you see any hidden disaster or this solution can work ? 

Thanks in advance


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100427/8aabaeda/attachment.html 

More information about the jboss-user mailing list