[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5306) Dialect resolution: Cannot set a custom dialect resolver programatically or using hibernate.cfg.xml

Steve Ebersole (JIRA) noreply at atlassian.com
Fri Jun 11 12:55:58 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole updated HHH-5306:
--------------------------------

         Assignee: Steve Ebersole
    Fix Version/s: cfg-rework

I agree with what you are saying, however there is an issue of scope.  As you pointed out, there is a lot of static-ness going on in Hibernate configuration.  The DialectResolvers registered with the DialectFactory are static as well.  Unfortunately this is just the way this stuff is designed at the moment.  There is a plan to change it.  Please see the design area of the wiki ( http://community.jboss.org/en/hibernate/dev/design ) for discussions of this.  http://community.jboss.org/docs/DOC-15371 is the discussion that most directly bears on this subject; its just a brief synopsis at this time though.

> Dialect resolution: Cannot set a custom dialect resolver programatically or using hibernate.cfg.xml
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5306
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5306
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.2, 3.5.0.Beta-1, 3.5.0-Beta-2, 3.5.0-Beta-3, 3.5.0-Beta-4, 3.5.0-CR-1, 3.5.0-CR-2, 3.5.0-Final, 3.5.1, 3.5.2
>            Reporter: Nikita D
>            Assignee: Steve Ebersole
>            Priority: Minor
>             Fix For: cfg-rework
>
>
> Starting with version 3.3, Hibernate introduced an extremely useful dialect resolution feature (http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#portability-dialectresolver). The problem is with the configuration of a custom dialect resolver:
>  * Setting the property Environment.DIALECT_RESOLVERS in the Configuration of a SessionFactory doesn't work, because DialectFactory only reads from Environment.getProperties(), which is only the global properties (system properties plus the hibernate.properties file).
>  * Setting a system property programatically is not safe, because the Environment class caches the system properties in a static constant, so if it's loaded before the code that sets the system property, the property will not be picked up.
>  * The registerDialectResolver() method on DialectFactory is not public.
> Ideally, it should be possible to configure a custom dialect resolver by setting the property Environment.DIALECT_RESOLVERS on a Configuration object, just as one would configure an explicit dialect. Alternatively, I think an acceptable "quick fix" would be to expose the registerDialectResolver() method on DialectFactory.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list