-->
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.  [ 1 post ] 
Author Message
 Post subject: SQL is not always working
PostPosted: Wed Nov 30, 2005 2:02 pm 
Newbie

Joined: Wed Nov 30, 2005 1:57 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

3.1 rc3

Name and version of the database you are using:

MySQL 4

The generated SQL (show_sql=true):

11:49:41,663 DEBUG org.hibernate.SQL: select p.`DIRECTORYID` as DIRECTOR1_0_, p.`NAME` as NAME2_0_, p.`ACTIVE` as ACTIVE3_23_0_, p.`CONCEPTION` as CONCEPTION4_23_0_, p.`LASTMODIFIED` as LASTMODI5_23_0_ from `REMOTEPRINCIPAL` p ,`REMOTEPRINCIPALATTRIBUTES` pa, `REMOTEATTRIBUTEVALUES` a, `ATTRIBUTEVALUES` av where p.`DIRECTORYID` = ? and p.`DIRECTORYID` = pa.`REMOTEPRINCIPALDIRECTORYID` and p.`NAME` = pa.`REMOTEPRINCIPALNAME` and pa.`ATTRIBUTEVALUESID` = a.`ID` and pa.`ATTRIBUTE` = 'mail' and a.`ID` = av.ATTRIBUTEVALUE and av.`VALUE` like ? order by p.`NAME` asc, p.`ACTIVE` asc
Hibernate: select p.`DIRECTORYID` as DIRECTOR1_0_, p.`NAME` as NAME2_0_, p.`ACTIVE` as ACTIVE3_23_0_, p.`CONCEPTION` as CONCEPTION4_23_0_, p.`LASTMODIFIED` as LASTMODI5_23_0_ from `REMOTEPRINCIPAL` p ,`REMOTEPRINCIPALATTRIBUTES` pa, `REMOTEATTRIBUTEVALUES` a, `ATTRIBUTEVALUES` av where p.`DIRECTORYID` = ? and p.`DIRECTORYID` = pa.`REMOTEPRINCIPALDIRECTORYID` and p.`NAME` = pa.`REMOTEPRINCIPALNAME` and pa.`ATTRIBUTEVALUESID` = a.`ID` and pa.`ATTRIBUTE` = 'mail' and a.`ID` = av.ATTRIBUTEVALUE and av.`VALUE` like ? order by p.`NAME` asc, p.`ACTIVE` asc
11:49:41,663 DEBUG org.hibernate.jdbc.AbstractBatcher: preparing statement
11:49:41,678 DEBUG org.hibernate.type.LongType: binding '1' to parameter: 1
11:49:41,678 DEBUG org.hibernate.type.StringType: binding '%.net%' to parameter: 2
11:49:41,694 DEBUG org.hibernate.jdbc.AbstractBatcher: about to open ResultSet (open ResultSets: 0, globally: 0)
11:49:41,694 DEBUG org.hibernate.loader.Loader: processing result set
11:49:41,694 DEBUG org.hibernate.loader.Loader: done processing result set (0 rows)
11:49:41,694 DEBUG org.hibernate.jdbc.AbstractBatcher: about to close ResultSet (open ResultSets: 1, globally: 1)
11:49:41,694 DEBUG org.hibernate.jdbc.AbstractBatcher: about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
11:49:41,694 DEBUG org.hibernate.jdbc.AbstractBatcher: closing statement
11:49:41,694 DEBUG org.hibernate.loader.Loader: total objects hydrated: 0


AND

11:50:33,428 DEBUG org.hibernate.SQL: select p.`DIRECTORYID` as DIRECTOR1_0_, p.`NAME` as NAME2_0_, p.`ACTIVE` as ACTIVE3_23_0_, p.`CONCEPTION` as CONCEPTION4_23_0_, p.`LASTMODIFIED` as LASTMODI5_23_0_ from `REMOTEPRINCIPAL` p ,`REMOTEPRINCIPALATTRIBUTES` pa, `REMOTEATTRIBUTEVALUES` a, `ATTRIBUTEVALUES` av where p.`DIRECTORYID` = ? and p.`DIRECTORYID` = pa.`REMOTEPRINCIPALDIRECTORYID` and p.`NAME` = pa.`REMOTEPRINCIPALNAME` and pa.`ATTRIBUTEVALUESID` = a.`ID` and pa.`ATTRIBUTE` = 'mail' and a.`ID` = av.ATTRIBUTEVALUE and av.`VALUE` like ? order by p.`NAME` asc, p.`ACTIVE` asc limit ?
Hibernate: select p.`DIRECTORYID` as DIRECTOR1_0_, p.`NAME` as NAME2_0_, p.`ACTIVE` as ACTIVE3_23_0_, p.`CONCEPTION` as CONCEPTION4_23_0_, p.`LASTMODIFIED` as LASTMODI5_23_0_ from `REMOTEPRINCIPAL` p ,`REMOTEPRINCIPALATTRIBUTES` pa, `REMOTEATTRIBUTEVALUES` a, `ATTRIBUTEVALUES` av where p.`DIRECTORYID` = ? and p.`DIRECTORYID` = pa.`REMOTEPRINCIPALDIRECTORYID` and p.`NAME` = pa.`REMOTEPRINCIPALNAME` and pa.`ATTRIBUTEVALUESID` = a.`ID` and pa.`ATTRIBUTE` = 'mail' and a.`ID` = av.ATTRIBUTEVALUE and av.`VALUE` like ? order by p.`NAME` asc, p.`ACTIVE` asc limit ?
11:50:33,428 DEBUG org.hibernate.jdbc.AbstractBatcher: preparing statement
11:50:33,444 DEBUG org.hibernate.type.LongType: binding '1' to parameter: 1
11:50:33,444 DEBUG org.hibernate.type.StringType: binding '%.net%' to parameter: 2
11:50:33,444 DEBUG org.hibernate.jdbc.AbstractBatcher: about to open ResultSet (open ResultSets: 0, globally: 0)
11:50:33,444 DEBUG org.hibernate.loader.Loader: processing result set
11:50:33,444 DEBUG org.hibernate.loader.Loader: result set row: 0
11:50:33,444 DEBUG org.hibernate.type.LongType: returning '1' as column: DIRECTOR1_0_
11:50:33,444 DEBUG org.hibernate.type.StringType: returning 'nstepka' as column: NAME2_0_



Problem:

The problem is that depending on which client is calling the method that is performing the searching, one is giving the desired results while the other is not. I have tested the SQL with the binding paramaters and everything seems to be working just fine.

What I do not understand is why the first statement isn't working with the same parameters!

Any help is greatly appreciated.


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

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.