Hi,
I've been playing with the Configuration.generateSchemaUpdateScript method and realised that the update sql output was always generating CREATE SEQUENCE statements for all sequences needed by the mapping document even when those sequences were clearly existing in the database. I then had a further look and saw that the PostgreSQLDialect doesn't overwrite the getQuerySequencesString() method and hence a call to this method always returns null which in turn causes the initSequences(connection, dialect) method in DatabaseMetadata not to do anything.
I've added the following method to PostgreSQLDialect
public String getQuerySequencesString()
{
return "SELECT relname FROM pg_catalog.pg_class WHERE relkind='S'";
}
and now everything works as expected.
I'm using Hibernate 2.1.8 and Postgres 7.4.8
Is that something that could be of general interest? I'm not sure whether above query is valid for all versions of Postgres but it seemed the only viable.
Joerg
|