Is it alfresco sharing hibernate config?

cancel
Showing results for 
Search instead for 
Did you mean: 
jose_tristan
Active Member

Is it alfresco sharing hibernate config?

Jump to solution

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.

 

1 Solution

Accepted Solutions
jose_tristan
Active Member

Re: Is it alfresco sharing hibernate config?

Jump to solution

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);
  }

View solution in original post

3 Replies
afaust
Master

Re: Is it alfresco sharing hibernate config?

Jump to solution

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.

jose_tristan
Active Member

Re: Is it alfresco sharing hibernate config?

Jump to solution

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.

 

 

jose_tristan
Active Member

Re: Is it alfresco sharing hibernate config?

Jump to solution

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);
  }