It a question out of curiousity, not that I’m solving a particular problem.
What is the reasoning bihind MyBatis to be ORM of choice in Flowable? What kind of advatages does it provide if compared to Hibernate? Have you guys ever considered other ORMs in early days of Flowable engine?
@moraleda, thanks for the link, it seems that MyBatis is stronger choice when it comes to “extremely high throughput”. I wander if authors had this on the list of reasons why.
I think the actual MongoDB support is in a separate Repo - https://github.com/flowable/flowable-mongodb and seems to have been updated for 6.6.0. I think it gives you a pretty good idea as to what is needed to switch the database layer.
I was not there when the decision was made to use MyBatis. However, what I can say is that MyBatis and Hibernate are entirely different beasts.
With MyBatis we have entire control over the SQL that gets sent to the DB, it is easily customizable based on a properties and we can provide different queries for different DBs. We are the ones that write the SQL that gets send over the wire and are not using an additional layer (like with Hibernate) in this case. We are not using the caching layer of MyBatis, we have our own caching layer for entities which we use to flush to the DB when the transaction commits. This is also highly optimised for our usecase, i.e. if we do an insert and then a delete in the same transaction we won’t send this instructions to the DB, think straight through process without wait state. The DbSqlSession is where that magic happens.
Why would you need to change the data layer to Hibernate? Hibernate uses JDBC which is the same as MyBatis and any other ORM that would be used for relational databases that support JDBC.
The links from @pstapleton are good to see how the data persistence layer can be changed. I also agree with him that it will be a lot of work to bring it to the same level as the current MyBatis implementation.
However, if you are asking for hibernate / JPA support for storing variables, Flowable already has that support out of the box. You can use JPA entities as variables and those will be stored and loaded correctly from Flowable through the JPA EntityManager. Have a look at JPAEntityVariableType.
We have a particular infrastructure - it puts a requirement to use hibernate plugins for very-important-enterprise-reasons. So we are obliged to to use hibernate everywhere. Original question comes from dilemma whats is easier: port such plugin to mybatis, or, may be, port flowable to hibernate (haha i know).
I was there when the decision for Mybatis was made ;-). It’s for the reasons listed above: a minimal layer around JDBC that gives full control about how things exactly go to the database. A decision we haven’t regretted so far.
I wasn’t there when the decision was made but in a previous life I was involved with another workflow engine that used Hibernate. After taking over the project and fighting with the database queries for about 2 months (slow, inefficient queries, too much overhead for transactions, etc.) we ripped out Hibernate and switched to MyBatis and never regretted it either.