Dialect resolution by R4R Team

Hibernate always need the specify dialect to use. Any user alwayes need the different target for the multiple database. Normally need this to user to configure the hibernate dialect or defining their own setting value. 

When we start hibernate with version 3.2 then we introduced the notion of configuring detecting the dialect to use on the basic of java.sql.DatabaseMetaData obtained from a java.sql.Connection to that database. When we do this it will be better expect that the resolution was limited to database. Hibernate know about ahead of time and it was in no way configurable or override able.

When we start hibernate with version 3.3 then hibernate it has powerful way to automatically determine with which dialect to should be used by relying on a series of delegaes which implement the org.hibernae.dialect.resolver.DialectResolver which defines only a single method that is given below:

public Dialect resolveDialect(DatabaseMetaData metaData) throws JDBCConnectionException

We can understand to the resolver the given database metadat then it returns the corresponding Dialect. If not it returns null and the process continues to the next resolver. The signature also identifies org.hibernate.exception. JDBCConnectionException as possibly being thrown. A JDBCConnectionException here is interpreted to imply a "not transient". When it done it make a connection problem and is used to indicate an immediate stop to resolution attemtps. In this method all other exception reslult in a warning and continuing on to the next resolver.

The resolver is that user can also register their own cutom resolver which will be processed ahead of the built in hibernate ones. We can we get the benifits from the different solution. That is it allwos easy integration for auto-detection of dialects beyond those shipped with hibernate itself. It allows you to specify to use a custom dialect when a particular database is recognized. To register one or more resolvers, simply specify them (seperated by commas, tabs or spaces) using the 'hibernate.dialect_resolvers' configuration setting (see the DIALECT_RESOLVERS constant on org.hibernate.cfg.Environment).
Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!