03-18-2020 09:33 AM
Hi,
we have an independent war in the same tomcat that deploy alfresco wars. This war also uses hibernate but connects with a different database. We are detecting that hibernate is using the same dialect set in Alfresco.
Is Alfresco sharing the hibernate config?
Thanks.
03-23-2020 07:37 AM
I found the issue. Alfresco is using Hibernate version 3.2.6 wich in class DialectFactory in method buildDialect is saving the "hibernate.dialect" as Java System property. In new versions, this method doesn't save the value in "hibernate.dialect.
public static Dialect buildDialect(Properties props, String databaseName, int databaseMajorVersion) throws HibernateException { String dialectName = props.getProperty("hibernate.dialect"); if (dialectName == null || dialectName.length() == 0) return determineDialect(databaseName, databaseMajorVersion); System.setProperty("hibernate.dialect", dialectName); return buildDialect(dialectName); }
03-18-2020 09:42 AM
Alfresco is barely using Hibernate - AFAIK the only Hibernate feature still used is the dialect detection and potentially some transaction handling. Alfresco is not actively "sharing" the Hibernate configuration. If you have provided the Alfresco config property "hibernate.dialect" via a Java -D system property, then of course that value will also be available to any other applications running on the same application server, and may influence their behaviour. This would be a configuration error, not an issue in Alfresco itself.
03-19-2020 06:14 AM
Thanks. Indeed I've seen "hibernate.dialect" is being saved as s java system property. However, I'm not able to find the responsible of that.
03-23-2020 07:37 AM
I found the issue. Alfresco is using Hibernate version 3.2.6 wich in class DialectFactory in method buildDialect is saving the "hibernate.dialect" as Java System property. In new versions, this method doesn't save the value in "hibernate.dialect.
public static Dialect buildDialect(Properties props, String databaseName, int databaseMajorVersion) throws HibernateException { String dialectName = props.getProperty("hibernate.dialect"); if (dialectName == null || dialectName.length() == 0) return determineDialect(databaseName, databaseMajorVersion); System.setProperty("hibernate.dialect", dialectName); return buildDialect(dialectName); }
Explore our Alfresco products with the links below. Use labels to filter content by product module.