cancel
Showing results for 
Search instead for 
Did you mean: 

How to get dbsqlSession

ahmetkara
Champ in-the-making
Champ in-the-making
Hi,

I need to get current db session. I am trying to get like that "CommandContext.getCurrent().getDbSqlSession()" but it returns null. Is it possible to get current session?

Thanks.
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
The commandContext can be obtained through Context.getCommandContext()

ahmetkara
Champ in-the-making
Champ in-the-making
Thanks for your reply, but I am trying like you wrote, unfotunately I get exception, like below.

INFO: JobAcquisitionThread starting to acquire jobs
Exception in thread "main" java.lang.NullPointerException

frederikherema1
Star Contributor
Star Contributor
Are you sure your database has/is being initialized? What's the value of the databaseUpgrade property?

ahmetkara
Champ in-the-making
Champ in-the-making
I've got no databaseUpgrade property in my activiti.cfg.xml, what should it be??
This is my config. file.
  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
 
    <!– Database configurations –>
    <property name="databaseType" value="mysql" />
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti_mine?autoReconnect=true" />
    <property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
    <property name="jdbcUsername" value="activiti" />
    <property name="jdbcPassword" value="activiti" />
<property name="history" value="full" />

<property name="databaseSchemaUpdate" value="true" />   
    <property name="jobExecutorActivate" value="true" />   
    <property name="mailServerHost" value="localhost" />
    <property name="mailServerPort" value="5025" />

  </bean>

frederikherema1
Star Contributor
Star Contributor
sorry, I meant "databaseSchemaUpdate" which looks allright in your config. Can you see the full stacktrace in your logs (line-number in JobeExecutor for example)?

ahmetkara
Champ in-the-making
Champ in-the-making
Sorry, I can't, that is all I see, I am posting again.

org.activiti.engine.impl.jobexecutor.JobAcquisitionThread run
INFO: JobAcquisitionThread starting to acquire jobs
Exception in thread "main" java.lang.NullPointerException