Quantcast

Proposal: deprecate HibernateDialectDetectorFactoryBean

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Proposal: deprecate HibernateDialectDetectorFactoryBean

Dmitriy Kopylenko
Hello Grails gurus.

I'm working on the patch to decouple Hibernate config from data source
config. While testing the code I've noticed that Hibernate (3.0.5 and
up, I believe) uses auto-detection strategy for DB dialect if the
dialect has not been explicitly specified (in
org.hibernate.cfg.SettingsFactory which delegates to
org.hibernate.dialect.DialectFactory, to be exact). Since this is the
same type of functionality that Grails'
HibernateDialectDetectorFactoryBean (it actually delegated to
org.hibernate.dialect.DialectFactory) provides, I think it makes this
factory bean irrelevant. I would propose to deprecate/get rid of
HibernateDialectDetectorFactoryBean in 0.5.

Does that make sense?

Cheers,
Dmitriy.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Proposal: deprecate HibernateDialectDetectorFactoryBean

Steven Devijver
Dmitriy,

I know that when I wrote this class Hibernate could auto-detect some
databases. I wrote this class to take the Spring approach of database
detection. If you're sure that Hibernate now recognizes all databases
then please go ahead and remove the class.

Thanks

Steven

On 1/26/07, Dmitriy Kopylenko <[hidden email]> wrote:

> Hello Grails gurus.
>
> I'm working on the patch to decouple Hibernate config from data source
> config. While testing the code I've noticed that Hibernate (3.0.5 and
> up, I believe) uses auto-detection strategy for DB dialect if the
> dialect has not been explicitly specified (in
> org.hibernate.cfg.SettingsFactory which delegates to
> org.hibernate.dialect.DialectFactory, to be exact). Since this is the
> same type of functionality that Grails'
> HibernateDialectDetectorFactoryBean (it actually delegated to
> org.hibernate.dialect.DialectFactory) provides, I think it makes this
> factory bean irrelevant. I would propose to deprecate/get rid of
> HibernateDialectDetectorFactoryBean in 0.5.
>
> Does that make sense?
>
> Cheers,
> Dmitriy.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Proposal: deprecate HibernateDialectDetectorFactoryBean

graemer
Thing is Hibernate still has trouble recognising some databases, hence
we we all detection of the dialect from a
hibernate-dialects.properties file. This functionality should be in
the FactoryBean

Cheers

On 1/27/07, Steven Devijver <[hidden email]> wrote:

> Dmitriy,
>
> I know that when I wrote this class Hibernate could auto-detect some
> databases. I wrote this class to take the Spring approach of database
> detection. If you're sure that Hibernate now recognizes all databases
> then please go ahead and remove the class.
>
> Thanks
>
> Steven
>
> On 1/26/07, Dmitriy Kopylenko <[hidden email]> wrote:
> > Hello Grails gurus.
> >
> > I'm working on the patch to decouple Hibernate config from data source
> > config. While testing the code I've noticed that Hibernate (3.0.5 and
> > up, I believe) uses auto-detection strategy for DB dialect if the
> > dialect has not been explicitly specified (in
> > org.hibernate.cfg.SettingsFactory which delegates to
> > org.hibernate.dialect.DialectFactory, to be exact). Since this is the
> > same type of functionality that Grails'
> > HibernateDialectDetectorFactoryBean (it actually delegated to
> > org.hibernate.dialect.DialectFactory) provides, I think it makes this
> > factory bean irrelevant. I would propose to deprecate/get rid of
> > HibernateDialectDetectorFactoryBean in 0.5.
> >
> > Does that make sense?
> >
> > Cheers,
> > Dmitriy.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
Graeme Rocher
Grails Project Lead
http://grails.org

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Proposal: deprecate HibernateDialectDetectorFactoryBean

Steven Devijver
The thing is: Spring can recognize the different databases. I'm not
sure which databases are and aren't recognized by Hibernate.

Also, I guess Hibernate needs to be more precise, like recognizing the
version number. Maybe this is required to cater for subtle yet
important difference between versions.

Obviously, Hibernate does much more work based on the result of the
detection than Spring which only uses it - as far as I know - to
translate exceptions.

Steven

On 1/27/07, Graeme Rocher <[hidden email]> wrote:

> Thing is Hibernate still has trouble recognising some databases, hence
> we we all detection of the dialect from a
> hibernate-dialects.properties file. This functionality should be in
> the FactoryBean
>
> Cheers
>
> On 1/27/07, Steven Devijver <[hidden email]> wrote:
> > Dmitriy,
> >
> > I know that when I wrote this class Hibernate could auto-detect some
> > databases. I wrote this class to take the Spring approach of database
> > detection. If you're sure that Hibernate now recognizes all databases
> > then please go ahead and remove the class.
> >
> > Thanks
> >
> > Steven
> >
> > On 1/26/07, Dmitriy Kopylenko <[hidden email]> wrote:
> > > Hello Grails gurus.
> > >
> > > I'm working on the patch to decouple Hibernate config from data source
> > > config. While testing the code I've noticed that Hibernate (3.0.5 and
> > > up, I believe) uses auto-detection strategy for DB dialect if the
> > > dialect has not been explicitly specified (in
> > > org.hibernate.cfg.SettingsFactory which delegates to
> > > org.hibernate.dialect.DialectFactory, to be exact). Since this is the
> > > same type of functionality that Grails'
> > > HibernateDialectDetectorFactoryBean (it actually delegated to
> > > org.hibernate.dialect.DialectFactory) provides, I think it makes this
> > > factory bean irrelevant. I would propose to deprecate/get rid of
> > > HibernateDialectDetectorFactoryBean in 0.5.
> > >
> > > Does that make sense?
> > >
> > > Cheers,
> > > Dmitriy.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
>
> --
> Graeme Rocher
> Grails Project Lead
> http://grails.org
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Proposal: deprecate HibernateDialectDetectorFactoryBean

Dmitriy Kopylenko
 From the top of my head (I don't have the src code in front of me)  
HDDFB uses JdbcTemplate's helper utility methods to get the DB  
metadata from the driver like db name and db major version. Then it  
uses Hibernate's DialectFactory to obtain the instance of the  
Dialect. In case of older Oracle driver (that's the db I work with)  
the get major version is not supported and the driver throws an  
exception which is not handled and the entire application blows up on  
start up.

Hibernate (as far as I could have digested from the src) does the  
similar thing e.g. get the db metadata and then uses DialectFactory,  
but also handles the unsupported operation exception from Oracle  
driver (for get major version) and instead defaulted it to 0 (zero),  
hence the resulted Dialect turned out to be OracleDialect instead of  
more precise Oracle9Dialect (which is not a big deal). So in my case,  
the HDDFB was "in the way" instead of helping. And since the approach  
of getting the Dialect appeared similar to me between Grails and  
Hibernate, I wondered.

If you have a chance and desire, take a look at  
org.hibernate.cfg.SettingsFactory

Regards,
Dmitriy.



On Jan 27, 2007, at 7:48 AM, Steven Devijver wrote:

> The thing is: Spring can recognize the different databases. I'm not
> sure which databases are and aren't recognized by Hibernate.
>
> Also, I guess Hibernate needs to be more precise, like recognizing the
> version number. Maybe this is required to cater for subtle yet
> important difference between versions.
>
> Obviously, Hibernate does much more work based on the result of the
> detection than Spring which only uses it - as far as I know - to
> translate exceptions.
>
> Steven
>
> On 1/27/07, Graeme Rocher <[hidden email]> wrote:
>> Thing is Hibernate still has trouble recognising some databases,  
>> hence
>> we we all detection of the dialect from a
>> hibernate-dialects.properties file. This functionality should be in
>> the FactoryBean
>>
>> Cheers
>>
>> On 1/27/07, Steven Devijver <[hidden email]> wrote:
>> > Dmitriy,
>> >
>> > I know that when I wrote this class Hibernate could auto-detect  
>> some
>> > databases. I wrote this class to take the Spring approach of  
>> database
>> > detection. If you're sure that Hibernate now recognizes all  
>> databases
>> > then please go ahead and remove the class.
>> >
>> > Thanks
>> >
>> > Steven
>> >
>> > On 1/26/07, Dmitriy Kopylenko <[hidden email]> wrote:
>> > > Hello Grails gurus.
>> > >
>> > > I'm working on the patch to decouple Hibernate config from  
>> data source
>> > > config. While testing the code I've noticed that Hibernate  
>> (3.0.5 and
>> > > up, I believe) uses auto-detection strategy for DB dialect if the
>> > > dialect has not been explicitly specified (in
>> > > org.hibernate.cfg.SettingsFactory which delegates to
>> > > org.hibernate.dialect.DialectFactory, to be exact). Since this  
>> is the
>> > > same type of functionality that Grails'
>> > > HibernateDialectDetectorFactoryBean (it actually delegated to
>> > > org.hibernate.dialect.DialectFactory) provides, I think it  
>> makes this
>> > > factory bean irrelevant. I would propose to deprecate/get rid of
>> > > HibernateDialectDetectorFactoryBean in 0.5.
>> > >
>> > > Does that make sense?
>> > >
>> > > Cheers,
>> > > Dmitriy.
>> > >
>> > >  
>> ---------------------------------------------------------------------
>> > > To unsubscribe from this list please visit:
>> > >
>> > >     http://xircles.codehaus.org/manage_email
>> > >
>> > >
>> >
>> >  
>> ---------------------------------------------------------------------
>> > To unsubscribe from this list please visit:
>> >
>> >     http://xircles.codehaus.org/manage_email
>> >
>> >
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> http://grails.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Loading...