-->
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.  [ 7 posts ] 
Author Message
 Post subject: Hibernate, Postgresql and int8/int2 issue
PostPosted: Tue Sep 23, 2003 7:34 pm 
Newbie

Joined: Tue Sep 02, 2003 3:14 pm
Posts: 11
Hi,

i use Long for all my object ids and therefore they are mapped as int8 in postgresql. It's a known issue that you have to explicitly cast into int8 when you pass a parameter if you wish to use the index with Postgresql.

Example:

- select * from foo where id=100; // will not use pk index
- select * from foo where id=100::int8 //will use pk index
- select * from foo where id='100' // will use pk index

I looked at the dialect class but it does not look like i can tell Hibernate about this Postgresql issue, have i missed something ?

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 24, 2003 3:58 pm 
Newbie

Joined: Tue Sep 02, 2003 3:14 pm
Posts: 11
Nobody from the postgres user base has an inpout about this issue please ? This is a rather annoying problem because at the moment all my object lookup are not very efficient (seq scan all the time....)

Thx in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2003 10:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
My understanding is that this was fixed in Postgres quite a while ago.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2003 10:30 am 
Newbie

Joined: Wed Sep 17, 2003 8:26 am
Posts: 16
afaik not really,

there exists a patch to the jdbc-driver that fixes the problem. but i had some issues with 7.2.4 - the patch is for the jdbc-driver for 7.3.x - and the patched driver. last info from the patch-author was that somebody else took over to rewrite the patch and the jdbc-driver but i don't know if something happened yet. this info is about 8 weeks old. in official releases, the problem should still be there.

jan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2003 12:08 pm 
Newbie

Joined: Tue Sep 02, 2003 3:14 pm
Posts: 11
Jan, do you still have the url where i can find this patch please ?

As for Hibernate, it would be pretty interesting to enhance the dialect class to allow transformation of parameter depending of their type (default = no transformation) so we could append ::int8 for Long type ..int2 for short type etc... I think it could even be usefull for other needs.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 06, 2003 10:09 am 
Newbie

Joined: Wed Sep 17, 2003 8:26 am
Posts: 16
sorry for my late post.

there is no url. i received a patched jdbc-driver from the guy who built the patch. he was really busy with his work at that time so he did not gave much info on how to get the sources out of postgres' cvs. i found some issues with postgres 7.2.x that should not occur with 7.3.x (but i still need to use 7.2.4). so i can supply you with the jar but i can not help you, if you run into problems.

jan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 06, 2003 2:13 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
jheise wrote:
sorry for my late post.

there is no url. i received a patched jdbc-driver from the guy who built the patch. he was really busy with his work at that time so he did not gave much info on how to get the sources out of postgres' cvs. i found some issues with postgres 7.2.x that should not occur with 7.3.x (but i still need to use 7.2.4). so i can supply you with the jar but i can not help you, if you run into problems.

jan


You can fix it yourself, the most simple way is to implement "wrapper" for
for JDBC driver and implement it this way:

void setInt(int index, int value)throws SQLException{
original.setString( index, Integer.toString(value) );
}
...

Looks like it conflicts with custom type support implementation on postgres and as I understand nobody going to rewrite it, but you can try it too.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.