[hibernate-dev] Table and quoted names

Steve Ebersole steve at hibernate.org
Fri Oct 1 13:57:42 EDT 2010


On Fri, 2010-10-01 at 18:26 +0200, Max Rydahl Andersen wrote:
> >> I'd like to figure out if this could be determined by looking at the
> >> DatabaseMetaData before making the Dialects have to specify this.  With
> >> the Dialects its just another thing we need to "keep in synch".  Not
> >> sure if you saw my comments in ObjectName wrt DatabaseMetaData, but
> >> those 2 were just the start of my investigation into this.
> > 
> > Sorry if I misunderstood or if it was discussed before, but when using 
> > DatabaseMetaData, it's always wise to have a fall back to the Dialect, 
> > in case the driver returns wrong information. For instance, the Sybase 
> > 15 JDBC4 driver returns a wrong value for getIdentifierQuoteString() 
> > (see https://jira.jboss.org/browse/JBPAPP-4661).
> > 
> 
> Totally agreed....I guess the question is though if that is going to part of what we
> today call Dialect or something else (If i follow Steve's comments right)

The vast majority of databases out there have more or less decent JDBC
drivers.  So forcing every single Dialect to reproduce information that
is already correctly available to us because of a few *known* slackers
seems silly.  Why can't the majority of Dialect's say "you know what...
you can already get this information via the driver's DatabaseMataData;
go look there"?  Thats all I'm saying.  

So because Sybase has crappy JDBC drivers (ok thats a tad harsh, but
making a point...) we need to penalize every Dialect developer into
duplicating this information?

For something like this, here is what I would propose...

1) 
public interface ObjectNameRenderer {
    public String render(OjectName objectName);
}

2) 
Dialect {
    ...
    ObjectNameRenderer getObjectNameRenderer() {
        return TrustMetaDataObjectNameRenderer.INSTANCE;
    }
}

And also allow one to be plugged in via "config", which would take
precedence if present.


-- 
Steve Ebersole <steve at hibernate.org>
http://hibernate.org




More information about the hibernate-dev mailing list