Good catch.  Instead of Dialect#getDialect(), you can just call #getDialect().  It's provided by the superclass and is a bit safer.