Alfresco CMS with myBatis

cancel
Showing results for 
Search instead for 
Did you mean: 
aakanksha_tejwa
Member II

Alfresco CMS with myBatis

Hi,

I have a simple question regarding the ORM used by Alfresco CMS. As I understand in the previous versions, Hibernate was used as the ORM layer which was later updated to iBatis. In our current project, we are using myBatis for the different database connections, hence we would like to maintain the consistency across. So my question is that is it possible to use myBatis instead of iBatis while using Alfresco CMS.

Kindly point me to the right direction or documentation.

Regards,

Aakanksha

5 Replies
afaust
Master

Re: Alfresco CMS with myBatis

Hibernate hasn't been used (as primary ORM) in a long time (since 4.0 only for jBPM, which was removed in 5.1/5.2). The Hibernate library continues to be used as a technical dependency, primarily to determine the database dialect to be used and for some transaction handling support. Alfresco is using myBatis (successor of ibatis) and of course you can use myBatis for custom database connections. You just have to use the version shipped with Alfresco and not include your own to avoid any conflicts.

aakanksha_tejwa
Member II

Re: Alfresco CMS with myBatis

Hi,

Thank you for your instant reply.

Actually I came across a document stating that Alfresco CMS uses iBatis - Alfresco drops LGPL'd Hibernate for iBatis - The H Open: News and Features , hence the confusion.

Could you please point me to the correct documentation to understand how can I use myBatis for my custom database connections while using Alfresco CMS?

afaust
Master

Re: Alfresco CMS with myBatis

There is no such documentation because that is not considered a standard / supported use case by Alfresco. It simply is technically possible (and I have been doing that in various customer projects).

aakanksha_tejwa
Member II

Re: Alfresco CMS with myBatis

Would it be possible for you to may be share a sample code or direct me to a sample project for reference wherein I could use myBatis for my custom database connections while using Alfresco CMS?

afaust
Master

Re: Alfresco CMS with myBatis

You'll find an example of custom ibatis handling in one of my addons - the Acosix alfresco-audit. In this addon, I am using ibatis for custom queries against the Alfresco database (modifying this example to use a different database is a trivial example). Among the various config files, take a look at the dao-context.xml and the ibatis mapping for different dialects. The only thing not covered in this would be transaction handling for a non-Alfresco database.