Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: [solved] reverse engineering with postgresql 8.1
PostPosted: Mon Mar 06, 2006 6:28 pm 
Newbie

Joined: Mon Mar 06, 2006 6:18 pm
Posts: 3
Location: Poland
I had a problem with reverse engineering after update to PostgreSQL 8.1. The foreign keys were not exctracted at all.
Stacktrace reported this problem "ERROR: function information_schema._pg_keypositions() does not exist"

This function exists in 8.0 databases, but not in fresh-created 8.1 databases. The solution is to add this function:
Code:
CREATE OR REPLACE FUNCTION information_schema._pg_keypositions()
  RETURNS SETOF int4 AS
$BODY$select g.s
        from generate_series(1,current_setting('max_index_keys')::int,1)
        as g(s)$BODY$
  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION information_schema._pg_keypositions() OWNER TO postgres;


Just though it might be useful :]
P.S. Just starting with Hibernate, looks promissing !


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 8:27 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Great. Did you send this onto the PostgreSQL devs?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 8:33 pm 
Newbie

Joined: Mon Mar 06, 2006 6:18 pm
Posts: 3
Location: Poland
No, it looked like hibernate tools bug to me. Thought this function is deprecated or sth like this.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 8:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The reverse engineering occurs through the JDBC driver's meta data facility. How the driver gets the information is not a hibernate issue. So the PostgreSQL JDBC driver is using this function. So the question then becomes - Did you use the correct driver for the database? There are new drivers for the 8.1 series.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 6:16 am 
Newbie

Joined: Mon Mar 06, 2006 6:18 pm
Posts: 3
Location: Poland
Hmmm....old JDBC driver...this might actally be the cause of the whole problem. Will check this. Sorry, i'm quite new to Java programming :]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 7:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
No problem we are here to help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 2:18 pm 
Regular
Regular

Joined: Wed Sep 28, 2005 6:45 pm
Posts: 56
I ran into exactly the same problem. (I could reverse-engineer from postgres 8.0, but couldn't from postgres 8.1)

Running the threadstarters sql fixed the problem though. It didn't seem to work with even the newest jdbc driver, but I am a bit confused to how to change the jdbc driver to use for reverse engineering in eclipse?

It would probably be helpful if you could locate the hibernate-console.xml inside the project somewhere, because if you press any wrong buttons in the wizards you have to start all over again?

(I also noticed that after running the sql you get a table in hibernate.reveng.xml file called pg_logdir_ls, which I didn't have otherwise. - I haven't a clue if this is relevant at all)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 4:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
just double click the console configuration to reedit it.

or if you want to move the mouse too then right click and select edit

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 4:35 pm 
Regular
Regular

Joined: Wed Sep 28, 2005 6:45 pm
Posts: 56
That helped to get me thinking about how Eclipse works, I was in the java perspective where you can't see the console configuration, so now I am atleast using the latest driver.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 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.