04-18-2018 01:29 AM
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
04-18-2018 04:06 AM
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.
04-18-2018 04:40 AM
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?
04-18-2018 07:58 AM
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).
04-19-2018 03:21 PM
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?
04-19-2018 05:31 PM
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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.