-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: generateSchemaUpdateScript and PostgreSQL
PostPosted: Fri Oct 21, 2005 6:17 am 
Newbie

Joined: Fri Oct 21, 2005 5:57 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Addendum
PostPosted: Fri Oct 21, 2005 6:39 am 
Newbie

Joined: Fri Oct 21, 2005 5:57 am
Posts: 2
Judging from the PostgreSQL docs the query should be fine for at least all versions >=7.2 (haven't checked anything older than that as the docs for older versions are not online anymore)

Joerg


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.