[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2933?page=c...
]
Tomoto Shimizu Washio commented on HHH-2933:
--------------------------------------------
Steve, thank you to give me your opinion.
The one thing I would change would be to not have Dialects themselves
involved at all in registration.
OK. In fact, registration by Dialects themselves was merely a shortcut for the cases
where Dialect and DialectResolver were one-to-one. It might not be necessary considering
the downside you pointed out.
Also, in terms of impl, I think it would be better to pass along the
Connection for resolution rather than individual pieces of metadata information from the
connection.
I like this direction also, but please let me ask a couple of questions.
(1) How about passing DatabaseMetaData instead of Connection? I think passing Connection
would imply that DialectResolver could operate the database (e.g. query or commit), which
I think would be far beyond DialectResolver's responsibility. If there were no
possible use case for DialectResolver using the real database connection in addition to
the metadata, I would prefer passing the metadata only.
(2) Let me make sure that you would like DialectResolver to instantiate Dialect directly
instead of returning the Dialect class. With DialectResolver returning a Dialect class
(not a Dialect instance), we might be able to totally control the lifetime of Dialect
instances, but I agree it would not make much sense. I am asking this just to make sure I
was not mistaken your intention.
DialectFactory dialects should be in a properties file
------------------------------------------------------
Key: HHH-2933
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2933
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Reporter: Mikael Kopteff
Attachments: dialect_registration.zip
Currently the DialectFactory has the static attribute MAPPERS, that hold the dialects. If
the dialect is not found, Hibernate will throw an exception. There is already an TODO tag,
set for this.So, could this be possibly done, so that the values really are a) in a
properties file or b)additions could be made to the map programmaticaly by users.
This would be more flexible for advanced users, that work with experimental jdbc
drivers(that don't return a standard name for the database).
The current trunk version of DialectFactory:
// TODO : this is the stuff it'd be nice to move to a properties file or some other
easily user-editable place
private static final Map MAPPERS = new HashMap();
static {
MAPPERS.put( "HSQL Database Engine", new VersionInsensitiveMapper(
"org.hibernate.dialect.HSQLDialect" ) );
MAPPERS.put( "H2", new VersionInsensitiveMapper(
"org.hibernate.dialect.H2Dialect" ) );
MAPPERS.put( "MySQL", new VersionInsensitiveMapper(
"org.hibernate.dialect.MySQLDialect" ) );
etc.....
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira