-->
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.  [ 10 posts ] 
Author Message
 Post subject: Migrating 3.0 -> 3.1 postgres function problem
PostPosted: Thu Jan 05, 2006 5:35 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
Hi, I'm having a problem migrating a hibernate 3.0 app to 3.1 for a few queries. I'll post others later, but the first one I'm tackling concerns using postgres functions using hibernate. I'm not going to be posting map files, since there aren't really all that important, but the bolded lines in this query cause the following problems to happen below. I guess I'm curious as to how to fix it since it used to work before. Thanks.

Code:
"select distinct sequence " +
"from Sequence sequence " +
"   inner join sequence.shipments shipment " +
"where " +
"   shipment.cargoControlNumber.carrierCode.id = :carrierCodeId and " +
"   shipment.cargoControlNumber.hasPars = :hasPars and " +
[b]"   char_length(shipment.cargoControlNumber.sequence) = :sequenceLength and " +[/b]
[b]"    to_number(shipment.cargoControlNumber.sequence,'999999999999999999999') between :firstSequence and :lastSequence"[/b]


Hibernate version:
3.1

Name and version of the database you are using:
postgres 8.1

The generated SQL (show_sql=true):
[16:34:06,506]DEBUG SQL:346 - select distinct sequence0_.id as id7_, sequence0_.date_created as date2_7_, sequence0_.creator_id as creator3_7_, sequence0_.shipment_type as shipment4_7_, sequence0_.pars_position as pars5_7_, sequence0_.owner_id as owner6_7_, sequence0_.first_cargo_control_number as first7_7_, sequence0_.last_cargo_control_number as last8_7_, sequence0_.unused_shipments as unused9_7_, sequence0_.is_active as is10_7_ from shipment_sequence sequence0_ inner join shipment shipments1_ on sequence0_.id=shipments1_.shipment_sequence_id where shipments1_.carrier_code_id=? and shipments1_.has_pars=? and char_length(shipments1_.sequence)=? and (to_number(shipments1_.sequence, '999999999999999999999') between ? and ?)
[16:34:06,521] WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: 22023
[16:34:06,521]ERROR JDBCExceptionReporter:72 - No value specified for parameter 3.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 05, 2006 6:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The HQL and the generated SQL looks fine. You can cut and paste it (sustitute args for ?) and try it out. The JDBC error indicates your issue is in passing the arguments to the query, eg, argument 3 is not there. Need to show the code that executes the query including setting the arguments.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 11:00 am 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
Hi again.

Thanks for the response!

I've tried to put the values in manually actually. The query generated actually works. Here is an example of the query with the values specified:

Code:
select distinct sequence0_.id as id7_, sequence0_.date_created as date2_7_, sequence0_.creator_id as creator3_7_, sequence0_.shipment_type as shipment4_7_, sequence0_.pars_position as pars5_7_, sequence0_.owner_id as owner6_7_, sequence0_.first_cargo_control_number as first7_7_, sequence0_.last_cargo_control_number as last8_7_, sequence0_.unused_shipments as unused9_7_, sequence0_.is_active as is10_7_ from shipment_sequence sequence0_ inner join shipment shipments1_ on sequence0_.id=shipments1_.shipment_sequence_id
where shipments1_.carrier_code_id=3 and shipments1_.has_pars=true and char_length(shipments1_.sequence)=10 and (to_number(shipments1_.sequence, '999999999999999999999') between '1543024560' and '1543024570')


Here is the code that creates the query. Notice that it's pretty simplistic. I've also printed the values to the screen that are being passed as parameters and all of them are defined (as in they are the same values that I've used for executing the manual sql query).

Code:
Query query = session.createQuery(
   "select distinct sequence " +
   "from Sequence sequence " +
   "   inner join sequence.shipments shipment " +
   "where " +
   "   shipment.cargoControlNumber.carrierCode.id = :carrierCodeId and " +
   "   shipment.cargoControlNumber.hasPars = :hasPars and " +
   "   char_length(shipment.cargoControlNumber.sequence) = :sequenceLength and " +
   "   to_number(shipment.cargoControlNumber.sequence,'999999999999999999999') between :firstSequence and :lastSequence"
);

query.setParameter( "sequenceLength", firstSequence.length() );
query.setParameter( "carrierCodeId", carrierCodeId );
query.setParameter( "hasPars", hasPars );
query.setParameter( "firstSequence", firstSequence );
query.setParameter( "lastSequence", lastSequence );

return query.list();


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 11:09 am 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
Also, I've noticed that replacing the parameters with hardcoded values makes the query execute properly, such as using:

Code:
"   char_length(shipment.cargoControlNumber.sequence) = 10 and " +
"   to_number(shipment.cargoControlNumber.sequence,'999999999999999999999') between 1543024560 and 1543024570"


That leads me to believe that something is wrong with hibernate passing the parameters... possible bug? I mean, this code has worked in older versions of hibernate 2.1.7 and 3.0 and even an earlier version of 3.1 (the one that was 40 or 50kb smaller than the current production version available for download right now).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 11:12 am 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
The types of the values being passed in are:

final Long carrierCodeId
final boolean hasPars
final String firstSequence
final String lastSequence


Also, the mapping for Shipment and Sequence is:

Code:
   <class name="com.borderconnect.domain.shipment.ca.Shipment" table="shipment">
      <id name="id" column="id" type="long" unsaved-value="0">
         <generator class="sequence">
            <param name="sequence">rns_transaction_id_seq</param>
         </generator>
      </id>

      <component name="cargoControlNumber" class="com.borderconnect.domain.shipment.ca.CargoControlNumber">
         <many-to-one name="carrierCode" column="carrier_code_id"
            class="com.borderconnect.domain.shipment.ca.CarrierCode"
            cascade="save-update" />
         <property name="sequence" column="sequence" />
         <property name="hasPars" column="has_pars" />
      </component>

      <property name="transactionNumber" column="transaction_number" />

      <many-to-one name="serviceOption" column="service_option_id"
         class="com.borderconnect.domain.shipment.ca.ServiceOption" outer-join="false" />
      <many-to-one name="releaseOffice" column="release_office_id"
         class="com.borderconnect.domain.shipment.ca.ReleaseOffice" outer-join="false" />
      <many-to-one name="subLocation" column="sub_location_id"
         class="com.borderconnect.domain.shipment.ca.SubLocation" outer-join="false"
         access="field" />
      <property name="containerNumber" column="container_number" />
      <bag name="statusMessages" table="shipment_status" inverse="false"
         order-by="date desc" cascade="all" lazy="true">
         <key column="shipment_id" />
         <one-to-many class="com.borderconnect.domain.shipment.ca.ShipmentStatus" />
      </bag>
      <bag name="comments" table="shipment_comment" inverse="true"
         order-by="post_date asc" cascade="all-delete-orphan" lazy="true">
         <key column="shipment_id"/>
         <one-to-many class="com.borderconnect.domain.shipment.ca.ShipmentComment" />
      </bag>
      <many-to-one name="currentStatus" column="current_status_id"
         class="com.borderconnect.domain.shipment.ca.ShipmentStatus"
         outer-join="true" access="field" cascade="save-update" />
      <many-to-one name="driver" column="driver_id"
         class="com.borderconnect.domain.carrier.Driver" />
      <many-to-one name="sequence" column="shipment_sequence_id"
         class="com.borderconnect.domain.shipment.ca.sequence.Sequence" />
      <property name="isPurged" column="is_purged" />
   </class>

   <class
      name="com.borderconnect.domain.shipment.ca.sequence.Sequence"
      table="shipment_sequence"
      lazy="true"
   >
      <id name="id" column="id" type="long" unsaved-value="0">
         <generator class="sequence">
            <param name="sequence">shipment_sequence_id_seq</param>
         </generator>
      </id>
      <property name="dateCreated" column="date_created"  />
      <many-to-one name="creator" column="creator_id"
         class="com.borderconnect.domain.person.Person" />
      <component name="shipmentType" class="com.borderconnect.domain.shipment.ca.ShipmentType">
         <property name="name" column="shipment_type" />
      </component>
      <component name="parsPosition" class="com.borderconnect.domain.shipment.ca.ParsPosition">
         <property name="name" column="pars_position"/>
      </component>
      <many-to-one name="owner" column="owner_id"
         class="com.borderconnect.domain.carrier.Driver" />
      <property name="firstCargoControlNumber" column="first_cargo_control_number" />
      <property name="lastCargoControlNumber" column="last_cargo_control_number" />

      <!-- to_number(cargoControlNumber.sequence,'999999999999999999999') asc -->
      <bag name="shipments" table="shipment" lazy="true" inverse="true"
         cascade="all" order-by="sequence"
      >
         <key column="shipment_sequence_id"/>
         <one-to-many class="com.borderconnect.domain.shipment.ca.Shipment"/>
      </bag>
        <property name="unusedShipments" column="unused_shipments" access="field" />
      <property name="isActive" column="is_active" />

   </class>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 12:48 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
Okay, I think I fixed it... but I want a second opinion if this is correct.

I changed the following code to:

Code:
               query.setParameter( "sequenceLength", firstSequence.length(), Hibernate.INTEGER );
               query.setParameter( "firstSequence", firstSequence, Hibernate.STRING );
               query.setParameter( "lastSequence", lastSequence, Hibernate.STRING );


Now, I'm curious if this means the same thing as I intended, because now I'm passing strings and I'm wondering if to_number() will convert the strings to numbers, or do some other kind of comparison. All my original test cases are passing though, and they are fairly thorough, so maybe everything is fine. I'm going to investigate further though. I don't like taking chances.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 12:56 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
meh... I'm just using cast( bleh as int) and it works fine. Forget the whole to_number thing. I wonder why I never bothered to do it this way before... maybe it never existed or it never worked before. Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 7:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
using setParameter without the hibernate type so hibernate has to guess the type being passed. I never use this method as I would prefer to be explicit. Alternatively, you could use setInteger(), setString() etc as well.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 9:22 pm 
Newbie

Joined: Sun Apr 10, 2005 9:35 pm
Posts: 14
I have a similar problem to the original poster after upgrading from 3.0.1 to 3.1.2. I am using PostgresQL 8.1 on Windows XP Pro.

The exception generated is

Code:
org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not execute query; SQL [select distinct event0_.event_id as event1_32_0_, eventcrite1_.criterion_id as criterion1_17_1_, event0_.event_date as event3_32_0_, event0_.start_time as start4_32_0_, event0_.end_time as end5_32_0_, event0_.title as title32_0_, event0_.description as descript7_32_0_, event0_.last_updated as last8_32_0_, event0_.reminder_date as reminder9_32_0_, event0_.reminder_time as reminder10_32_0_, event0_.reminder_sent as reminder11_32_0_, event0_.lock_event as lock12_32_0_, event0_.club_id as club13_32_0_, event0_.venue_id as venue14_32_0_, event0_1_.meet_time as meet2_34_0_, event0_1_.home_game as home3_34_0_, event0_1_.oppo_club_id as oppo4_34_0_, event0_1_.oppo_team_id as oppo5_34_0_, event0_1_.team_id as team6_34_0_, event0_1_.fixture_type as fixture7_34_0_, event0_.type as type32_0_, eventcrite1_.participatory as particip2_17_1_, eventcrite1_.intersection_only as intersec3_17_1_, eventcrite1_.event_id as event4_17_1_, eventcrite1_.player_group_id as player5_17_1_, eventcrite1_.position_group_id as position6_17_1_ from hbm_events event0_ left outer join hbm_fixtures event0_1_ on event0_.event_id=event0_1_.event_id inner join hbm_event_criteria eventcrite1_ on event0_.event_id=eventcrite1_.event_id where (eventcrite1_.player_group_id in (? , ? , ? , ? , ? , ?)) and (eventcrite1_.position_group_id in (? , ? , ? , ? , ? , ? , ? , ?)) and event0_.event_date>=? and event0_.event_date<=? and (event0_.club_id in (?)) order by event0_.event_date]; No value specified for parameter 17.; nested exception is org.postgresql.util.PSQLException: No value specified for parameter 17.org.postgresql.util.PSQLException: No value specified for parameter 17.
at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:134)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:179)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:250)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)


Code:
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql=false
hibernate.jdbc.batch_size=15
hibernate.default_batch_fetch_size=16
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.use_query_cache=true
hibernate.cglib.use_reflection_optimizer=false


An abridged section of the mapping document is:
Code:
    <class name="Event" table="hbm_events" discriminator-value="event">
        <id name="id" column="event_id" type="java.lang.Long">
            <generator class="increment"/>
        </id>
        <discriminator column="type" type="string"/>
        <set name="eventCriteria" cascade="save-update,lock,evict">
            <key column="event_id"/>
            <one-to-many class="uk.co.mindfruit.coreweb.domain.EventCriterion"/>
        </set>
        <!-- properties omitted for brevity -->
        <many-to-one name="club"   class="uk.co.mindfruit.coreweb.domain.Club"   column="club_id"  cascade="lock,evict" />
        <subclass name="Fixture" discriminator-value="fixture">
            <meta attribute="generated-class" inherit="false">uk.co.mindfruit.coreweb.domain.HbmFixture</meta>
            <join table="hbm_fixtures">
                <key column="event_id"/>
                <!-- properties omitted for brevity -->
            </join>
        </subclass>
    </class>

    <class name="EventCriterion" table="hbm_event_criteria">
        <id name="id" column="criterion_id" type="java.lang.Long">
            <generator class="increment"/>
        </id>
        <property name="participatory" type="boolean"/>
        <many-to-one name="event" class="uk.co.mindfruit.coreweb.domain.Event" column="event_id" cascade="none"/>
        <many-to-one name="playerGroup"   class="uk.co.mindfruit.coreweb.domain.PlayerGroup"   column="player_group_id" cascade="none"/>
        <many-to-one name="positionGroup" class="uk.co.mindfruit.coreweb.domain.PositionGroup" column="position_group_id" cascade="none"/>
    </class>

    <class name="PlayerGroup" table="hbm_player_groups" discriminator-value="0" lazy="false">
        <id name="id" column="node_id" type="java.lang.Long">
            <generator class="increment"/>
        </id>
        <property name="name" type="string"/>
        <many-to-one name="club" class="uk.co.mindfruit.coreweb.domain.Club" column="club_id" cascade="none"/>
        <many-to-one name="sport" class="uk.co.mindfruit.coreweb.domain.SportType" column="sport_id" cascade="none"/>
        <set name="players" table="hbm_player_group_map" lazy="true" cascade="none">
            <key column="node_id"/>
            <many-to-many class="uk.co.mindfruit.coreweb.domain.Player" column="user_id" />
        </set>
        <subclass name="Team" discriminator-value="1">
            <meta attribute="generated-class" inherit="false">uk.co.mindfruit.coreweb.domain.HbmTeam</meta>
        </subclass>
    </class>

    <class name="PositionGroup" table="hbm_position_groups" lazy="false">
        <id name="id" column="node_id" type="java.lang.Long">
            <generator class="increment"/>
        </id>
        <many-to-one name="club" class="uk.co.mindfruit.coreweb.domain.Club" column="club_id" />
        <property name="name" type="string"/>
        <property name="number" type="string"/>
        <many-to-one name="sport" class="uk.co.mindfruit.coreweb.domain.SportType" column="sport_id" />
        <set name="players" table="hbm_position_group_map" lazy="true">
            <key column="node_id"/>
            <many-to-many class="uk.co.mindfruit.coreweb.domain.Player" column="user_id"/>
        </set>
    </class>



The query being executed is externalised as:

Code:
    <query name="positionGroup.ids-and-playerGroup.ids-to-events">
        <![CDATA[
     select distinct event, criterion
       from Event as event
       join event.eventCriteria as criterion
      where criterion.playerGroup.id in (:playerGroupIds)
        and criterion.positionGroup.id in (:positionGroupIds)
        and event.eventDate >= :startDate
        and event.eventDate <= :endDate
        and event.club.id in (:clubIds)
   order by event.eventDate
        ]]>
    </query>


and captured during debug from the PostgresQL JDBC driver looks like

Code:
select distinct event0_.event_id as event1_32_0_
               , eventcrite1_.criterion_id as criterion1_17_1_
               , event0_.event_date as event3_32_0_
               , event0_.start_time as start4_32_0_
               , event0_.end_time as end5_32_0_
               , event0_.title as title32_0_
               , event0_.description as descript7_32_0_
               , event0_.last_updated as last8_32_0_
               , event0_.reminder_date as reminder9_32_0_
               , event0_.reminder_time as reminder10_32_0_
               , event0_.reminder_sent as reminder11_32_0_
               , event0_.lock_event as lock12_32_0_
               , event0_.club_id as club13_32_0_
               , event0_.venue_id as venue14_32_0_
               , event0_1_.meet_time as meet2_34_0_
               , event0_1_.home_game as home3_34_0_
               , event0_1_.oppo_club_id as oppo4_34_0_
               , event0_1_.oppo_team_id as oppo5_34_0_
               , event0_1_.team_id as team6_34_0_
               , event0_1_.fixture_type as fixture7_34_0_
               , event0_.type as type32_0_
               , eventcrite1_.participatory as particip2_17_1_
               , eventcrite1_.intersection_only as intersec3_17_1_
               , eventcrite1_.event_id as event4_17_1_
               , eventcrite1_.player_group_id as player5_17_1_
               , eventcrite1_.position_group_id as position6_17_1_
            from hbm_events event0_
left outer join hbm_fixtures event0_1_
              on event0_.event_id=event0_1_.event_id
      inner join hbm_event_criteria eventcrite1_
              on event0_.event_id=eventcrite1_.event_id
           where (eventcrite1_.player_group_id in (51 , 53 , 60 , 61 , 50 , 52))
             and (eventcrite1_.position_group_id in (32 , 51 , 30 , 21 , 50 , 20 , 52 , 22))
             and event0_.event_date>=2006-03-11 +0000
             and event0_.event_date<=2006-03-11 +0000
             and (event0_.club_id in (?))
        order by event0_.event_date;


Do note that the parameter lists for eventcrite1_.player_group_id and eventcrite1.position_group_id have been expanded correctly yet the single parameter supplied for the event0_.club_id parameter list has not been substituted.

I noticed this post on the PostgresQL-JDBC message board, and judging by the timing I guess it could easily have arisen after upgrading to H3.1.

http://archives.postgresql.org/pgsql-jd ... g00168.php

But as this query worked for me before I upgraded to H3.1.2 and now does not work, I assume that something has changed within Hibernate to cause this failure in the PostgresQL driver, if indeed that is what it is. Any ideas?

Thanks

Michael


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 10:32 pm 
Newbie

Joined: Sun Apr 10, 2005 9:35 pm
Posts: 14
This "Postgres" error was a result of the "clubIds" parameter failing to be bound to the query, as you can see from the following debug:

Code:
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 60 -> playerGroupIds2_ [3]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 60 -> playerGroupIds2_ [3]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 32 -> positionGroupIds0_ [7]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 32 -> positionGroupIds0_ [7]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 50 -> positionGroupIds4_ [11]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 50 -> positionGroupIds4_ [11]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() Sat Mar 04 00:00:00 GMT 2006 -> startDate [15]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() Sat Mar 04 00:00:00 GMT 2006 -> startDate [15]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 53 -> playerGroupIds1_ [2]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 53 -> playerGroupIds1_ [2]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 30 -> positionGroupIds2_ [9]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 30 -> positionGroupIds2_ [9]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 52 -> playerGroupIds5_ [6]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 52 -> playerGroupIds5_ [6]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 20 -> positionGroupIds5_ [12]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 20 -> positionGroupIds5_ [12]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 52 -> positionGroupIds6_ [13]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 52 -> positionGroupIds6_ [13]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 50 -> playerGroupIds4_ [5]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 50 -> playerGroupIds4_ [5]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 51 -> positionGroupIds1_ [8]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 51 -> positionGroupIds1_ [8]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 61 -> playerGroupIds3_ [4]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 61 -> playerGroupIds3_ [4]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() Quintin RFC -> clubIds [17]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() Quintin RFC -> clubIds [17]
INFO  org.hibernate.type.LongType  - could not bind value 'Quintin RFC' to parameter: 17
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 22 -> positionGroupIds7_ [14]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 22 -> positionGroupIds7_ [14]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 21 -> positionGroupIds3_ [10]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 21 -> positionGroupIds3_ [10]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() Sat Mar 04 00:00:00 GMT 2006 -> endDate [16]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() Sat Mar 04 00:00:00 GMT 2006 -> endDate [16]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 51 -> playerGroupIds0_ [1]
DEBUG org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 51 -> playerGroupIds0_ [1]
WARN  org.hibernate.util.JDBCExceptionReporter  - SQL Error: 0, SQLState: 22023
ERROR org.hibernate.util.JDBCExceptionReporter  - No value specified for parameter 17.


Note the debug at 'INFO' level. I swear that Hibernate used to cope with a Collection of mapped objects, in this case Club.class, being passed in, and that it extracted the ID values from them.

Having done so manually and passed in a list of Long.class ID values, the query functions as expected.

An important question arises from this, though - shouldn't a failure to bind a parameter to the Query result in an exception being thrown from Hibernate, rather than letting it be thrown from the JdbcDriver code? Debugging into Driver code is arcane at best and impossible at worst.

Michael


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