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;
@Override
public long getNextId() {
return commandService.execute(new SequenceDbIdGeneratorCmd());
}
}
...
and
...
public class SequenceDbIdGeneratorCmd implements Command<Long> {
private static final long serialVersionUID = -8109570788517494372L;
@SuppressWarnings("unchecked")
@Override
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>
<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
Stefano
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/539800#539800]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]