cancel
Showing results for 
Search instead for 
Did you mean: 

Customizing the DbSqlSessionFactory

subramanya_murt
Champ in-the-making
Champ in-the-making
Hello,

I am trying to customize the DbSqlSessionFactory by sub-classing it. Basically, I want to add more specialized database specific queries without having to change DbSqlSessionFactory.

Please let me know how do I make the activiti engine to use the subclass of DbSqlSessionFactory without having to change anything in the activiti code as such.

I guess this should be possible, even though I am not able to figure out how.

Thanks in advance.
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
There is a map "customSessionFactories" on the processEngineConfiguration. Add your factory to it, using the key DbSQLSesison.class. I think that should do the trick…

subramanya_murt
Champ in-the-making
Champ in-the-making
Thanks a lot for your input. I could successfully load my custom DbSqlSessionFactory 🙂

alandemarest
Champ in-the-making
Champ in-the-making
This is my first post on this forum, so Hi everyone!

I'm trying to do the same, but i'm using spring. And as opposed to Your advice of using map I use list.
MyDbSqlSessionFactory extends DbSqlSessionFactory implements SessionFactory
and has implemented methods as super-class.

So far i have:

<bean id="myDbSqlSessionFactory" class="com.my.MyDbSqlSessionFactory"/>
….
and in processEngineConfiguration bean:
….
<property name="customSessionFactories">
  <list>
   <ref bean="myDbSqlSessionFactory"/>
   <ref bean="myManagerSessionFactory"/>
  </list>
</property>

NOTE: myManagerSessionfactory Works just fine

When Jetty initialize the context I have NullPointerException,
which source is shortly speaking sqlSessionFactory field

I'm really stuck. In my Implementation i just want to override getStatement method

Thanks in advance