-->
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.  [ 8 posts ] 
Author Message
 Post subject: ordinal parameter mistmatch
PostPosted: Wed Nov 08, 2006 1:46 pm 
Newbie

Joined: Wed Nov 08, 2006 1:35 pm
Posts: 4
What does it mean to have an ordinal parameter mismatch? I'm getting it when calling session.createQuery with a simple query. If I rearrange the query ordering it doesn't happen.

FROM Student AS student
WHERE student.generalEdFte= ?
AND student.studentStatus.locallyEnrolled = TRUE

Thanks,
Jason


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 2:46 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
Can we see you code, mappings, the exception, the generated SQL and any debug/trace info?

Hibernate ordinal parameters are zero-based while JDBC parameters start with 1.

Curtis ...

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 3:03 pm 
Newbie

Joined: Wed Nov 08, 2006 1:35 pm
Posts: 4
Hibernate version:
3.2.0.ga

Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="SOpen.spm.dao.Student"
table="Student"
proxy="SOpen.spm.dao.Student"
>

<id
name="primaryKey"
column="primary_key"
type="long"
unsaved-value="0"
>
<generator class="sequence">
<param name="sequence">hibernate_sequence</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Student.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<version
name="recordVersion"
column="record_version"
type="int"
/>

<many-to-one
name="snapshotRoot"
class="SOpen.spm.dao.StudentRoot"
cascade="all"
outer-join="auto"
update="true"
insert="true"
column="root_key"
not-null="true"
/>

<property
name="birthDate"
type="java.util.Date"
update="true"
insert="true"
column="birth_date"
/>

<property
name="studentNumber"
type="java.lang.String"
update="true"
insert="true"
column="student_number"
/>

<property
name="primaryGender"
type="java.lang.String"
update="true"
insert="true"
column="primary_gender"
/>

<property
name="generalEdFte"
type="float"
update="true"
insert="true"
column="general_ed_fte"
/>

<component
name="studentName"
class="SOpen.common.dao.Name"
>
<property
name="firstName"
type="java.lang.String"
update="true"
insert="true"
column="first_name"
/>

<property
name="lastName"
type="java.lang.String"
update="true"
insert="true"
column="last_name"
/>

<property
name="middleName"
type="java.lang.String"
update="true"
insert="true"
column="middle_name"
/>

<property
name="generation"
type="java.lang.String"
update="true"
insert="true"
column="generation_name"
/>

</component>

<many-to-one
name="homeAddress"
class="SOpen.common.dao.Address"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="home_address_id"
/>

<property
name="homePhone"
type="java.lang.String"
update="true"
insert="true"
column="home_phone"
/>

<many-to-one
name="schoolYear"
class="SOpen.spm.dao.SchoolYear"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="school_year_id"
/>

<many-to-one
name="primaryLocation"
class="SOpen.common.dao.Location"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="primary_location_id"
/>

<many-to-one
name="studentStatus"
class="SOpen.spm.dao.StudentStatus"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="student_status_id"
/>

<many-to-one
name="primaryEthnicity"
class="SOpen.common.dao.Ethnicity"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="primary_ethnicity_id"
/>

<many-to-one
name="homeLanguage"
class="SOpen.common.dao.Language"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="home_language_id"
/>

<many-to-one
name="adultStatus"
class="SOpen.spm.dao.AdultStatus"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="adult_status_id"
/>

<many-to-one
name="atRisk"
class="SOpen.spm.dao.AtRisk"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="at_risk_id"
/>

<many-to-one
name="citizenship"
class="SOpen.spm.dao.Citizenship"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="citizenship_id"
/>

<many-to-one
name="dualEnroll"
class="SOpen.spm.dao.DualEnrollment"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="dual_enroll_id"
/>

<many-to-one
name="englishAsSecondLanguage"
class="SOpen.spm.dao.EnglishAsSecondLanguage"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="english_as_second_language_id"
/>

<many-to-one
name="freeLunch"
class="SOpen.spm.dao.FreeLunchEligibility"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="free_lunch_id"
/>

<many-to-one
name="giftedTalented"
class="SOpen.spm.dao.GiftedTalented"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="gifted_talented_id"
/>

<many-to-one
name="homeless"
class="SOpen.spm.dao.Homeless"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="homeless_id"
/>

<many-to-one
name="immigrant"
class="SOpen.spm.dao.Immigrant"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="immigrant_id"
/>

<many-to-one
name="migrant"
class="SOpen.spm.dao.Migrant"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="migrant_id"
/>

<many-to-one
name="limitedEnglishProficient"
class="SOpen.spm.dao.LimitedEnglishProf"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="limited_english_proficient_id"
/>

<many-to-one
name="parentalStatus"
class="SOpen.spm.dao.ParentalStatus"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="parental_status_id"
/>

<many-to-one
name="title1Elig"
class="SOpen.spm.dao.Title1Eligibility"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="title1_elig_id"
/>

<many-to-one
name="instructionalSetting"
class="SOpen.spm.dao.InstructionalSetting"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="instructional_setting_id"
/>

<many-to-one
name="specialEdCode"
class="SOpen.spm.dao.SpecialEducation"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="special_ed_code_id"
/>

<many-to-one
name="economicStatus"
class="SOpen.spm.dao.EconomicStatus"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="economic_status_id"
/>

<many-to-one
name="attendanceEligibility"
class="SOpen.spm.dao.AttendanceEligibility"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="attendance_eligibility_id"
/>

<many-to-one
name="vocationalClass"
class="SOpen.spm.dao.VocationalClassification"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="vocational_class_id"
/>

<many-to-one
name="lockerNum"
class="SOpen.spm.dao.Locker"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="locker_num_id"
/>

<many-to-one
name="busRoute"
class="SOpen.spm.dao.BusRoute"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="bus_route_id"
/>

<many-to-one
name="gradeCatalog"
class="SOpen.spm.dao.GradeCatalog"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="grade_catalog_id"
/>

<many-to-one
name="homeRoom"
class="SOpen.spm.dao.RoomCatalog"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="room_catalog_id"
/>

<property
name="unlistedPhone"
type="boolean"
update="true"
insert="true"
column="unlisted_phone"
/>

<many-to-one
name="counselor"
class="SOpen.common.dao.PersonnelRoot"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="counselor_id"
/>

<many-to-one
name="teacherOfRecord"
class="SOpen.common.dao.PersonnelRoot"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="teacher_of_record_id"
/>

<component
name="snapshotNote"
class="SOpen.common.dao.SnapshotNote"
>

<many-to-one
name="changeReason"
class="SOpen.common.dao.ChangeReason"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="change_reason_id"
/>

<property
name="changeComments"
type="java.lang.String"
update="true"
insert="true"
column="change_comments"
/>

<property
name="effectiveStartDate"
type="java.util.Date"
update="true"
insert="true"
column="change_effective_date"
/>

<property
name="effectiveEndDate"
type="java.util.Date"
update="true"
insert="true"
column="change_effective_through"
/>

</component>

<property
name="snapshotIndex"
type="int"
update="true"
insert="true"
column="snapshot_order"
/>

<property
name="intGUID"
type="java.lang.String"
update="true"
insert="true"
column="GUID"
/>

<component
name="changeNote"
class="SOpen.common.dao.DAOChangeNote"
>

<many-to-one
name="lastChangedBy"
class="SOpen.common.dao.UserProfile"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="changed_by_user"
/>

<property
name="lastChangedAt"
type="java.util.Date"
update="true"
insert="true"
column="changed_at"
/>

<property
name="createdAt"
type="java.util.Date"
update="true"
insert="true"
column="created_at"
/>

<many-to-one
name="createdBy"
class="SOpen.common.dao.UserProfile"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="created_by_user"
/>

</component>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Student.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="SOpen.spm.dao.StudentStatus"
table="student_status_code"
proxy="SOpen.spm.dao.StudentStatus"
>

<id
name="primaryKey"
column="primary_key"
type="long"
unsaved-value="0"
>
<generator class="sequence">
<param name="sequence">hibernate_sequence</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-StudentStatus.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<version
name="recordVersion"
column="record_version"
type="int"
/>

<property
name="locallyEnrolled"
type="boolean"
update="true"
insert="true"
column="is_locally_enrolled"
/>

<many-to-one
name="schoolYear"
class="SOpen.spm.dao.SchoolYear"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="school_year_id"
/>

<property
name="officiallyEnrolled"
type="boolean"
update="true"
insert="true"
column="is_officially_enrolled"
/>

<property
name="visibleOnReports"
type="boolean"
update="true"
insert="true"
column="is_visible_on_reports"
/>

<many-to-one
name="statusGroup"
class="SOpen.spm.dao.StatusGroup"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="status_group_id"
/>

<property
name="includedInRequestCollection"
type="boolean"
update="true"
insert="true"
column="is_included_in_request_collection"
/>

<property
name="includedInScheduling"
type="boolean"
update="true"
insert="true"
column="is_included_in_scheduling"
/>

<property
name="includedInSchedulingReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_scheduling_reports"
/>

<property
name="includedInCourseAttendanceCollection"
type="boolean"
update="true"
insert="true"
column="is_included_in_course_attendance_collection"
/>

<property
name="includedInCourseAttendanceReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_course_attendance_reports"
/>

<property
name="includedInDailyAttendanceCollection"
type="boolean"
update="true"
insert="true"
column="is_included_in_daily_attendance_collection"
/>

<property
name="includedInDailyAttendanceReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_daily_attendance_reports"
/>

<property
name="includedInGradeReportingCollection"
type="boolean"
update="true"
insert="true"
column="is_included_in_grade_reporting_collection"
/>

<property
name="includedInGradeReportingReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_grade_reporting_reports"
/>

<property
name="includedInGpa"
type="boolean"
update="true"
insert="true"
column="is_included_in_gpa"
/>

<property
name="includedInHonorRolls"
type="boolean"
update="true"
insert="true"
column="is_included_in_honor_roll"
/>

<property
name="includedInHonorRollReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_honor_roll_reports"
/>

<property
name="includedInRanking"
type="boolean"
update="true"
insert="true"
column="is_included_in_ranking"
/>

<property
name="includedInRankingReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_ranking_reports"
/>

<property
name="awardedCredit"
type="boolean"
update="true"
insert="true"
column="is_awarded_credit"
/>

<property
name="includedInProgressReportingCollection"
type="boolean"
update="true"
insert="true"
column="is_included_in_progress_reporting_collection"
/>

<property
name="includedInProgressReportingReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_progress_reporting_reports"
/>

<property
name="includedInTranscriptBuild"
type="boolean"
update="true"
insert="true"
column="is_included_in_transcript_build"
/>

<property
name="includedInTranscriptReports"
type="boolean"
update="true"
insert="true"
column="is_included_in_transcript_reports"
/>

<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="code"
/>

<property
name="description"
type="text"
update="true"
insert="true"
column="description"
/>

<property
name="comments"
type="text"
update="true"
insert="true"
column="comments"
/>

<property
name="active"
type="boolean"
update="true"
insert="true"
column="is_active"
/>

<property
name="intGUID"
type="java.lang.String"
update="true"
insert="true"
column="GUID"
/>

<component
name="changeNote"
class="SOpen.common.dao.DAOChangeNote"
>

<many-to-one
name="lastChangedBy"
class="SOpen.common.dao.UserProfile"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="changed_by_user"
/>

<property
name="lastChangedAt"
type="java.util.Date"
update="true"
insert="true"
column="changed_at"
/>

<property
name="createdAt"
type="java.util.Date"
update="true"
insert="true"
column="created_at"
/>

<many-to-one
name="createdBy"
class="SOpen.common.dao.UserProfile"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="created_by_user"
/>

</component>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-StudentStatus.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

Session session = config.buildSessionFactory().openSession();
String query =
"FROM Student AS student " +
"WHERE student.generalEdFte= ? " +
"AND student.studentStatus.locallyEnrolled = TRUE";

session.createQuery(query);


Full stack trace of any exception that occurs:

org.hibernate.HibernateException: ordinal parameter mismatch
at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:275)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:97)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at SOpen.tools.Permission.CreatePermission.testOrdinal(CreatePermission.java:3239)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)



Name and version of the database you are using:
Postgres 8.1.1


The generated SQL (show_sql=true):
Doesn't get that far

Debug level Hibernate log excerpt:
I'm working on setting this up. Will post it later.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 3:27 pm 
Newbie

Joined: Wed Nov 08, 2006 1:35 pm
Posts: 4
Debug level Hibernate log excerpt:

14:23:41,126 DEBUG SessionImpl:220 - opened session at timestamp: 4763704610115584
14:24:20,483 DEBUG QueryPlanCache:70 - unable to locate HQL query plan in cache; generating (FROM Student AS student WHERE student.generalEdFte= ? AND student.studentStatus.locallyEnrolled = TRUE)
14:24:21,290 DEBUG QueryTranslatorImpl:246 - parse() - HQL: FROM SOpen.spm.dao.Student AS student WHERE student.generalEdFte= ? AND student.studentStatus.locallyEnrolled = TRUE
14:24:21,669 DEBUG AST:266 - --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| \-[FROM] 'FROM'
| \-[RANGE] 'RANGE'
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[IDENT] 'SOpen'
| | | | \-[IDENT] 'spm'
| | | \-[IDENT] 'dao'
| | \-[IDENT] 'Student'
| \-[ALIAS] 'student'
\-[WHERE] 'WHERE'
\-[AND] 'AND'
+-[EQ] '='
| +-[DOT] '.'
| | +-[IDENT] 'student'
| | \-[IDENT] 'generalEdFte'
| \-[PARAM] '?'
\-[EQ] '='
+-[DOT] '.'
| +-[DOT] '.'
| | +-[IDENT] 'student'
| | \-[IDENT] 'studentStatus'
| \-[IDENT] 'locallyEnrolled'
\-[TRUE] 'TRUE'

14:24:21,703 DEBUG ErrorCounter:68 - throwQueryException() : no errors
14:24:21,890 DEBUG HqlSqlBaseWalker:111 - select << begin [level=1, statement=select]
14:24:21,976 DEBUG FromElement:105 - FromClause{level=1} : SOpen.spm.dao.Student (student) -> student0_
14:24:22,002 DEBUG FromReferenceNode:51 - Resolved : student -> student0_.primary_key
14:24:22,015 DEBUG DotNode:541 - getDataType() : generalEdFte -> org.hibernate.type.FloatType@324ff
14:24:22,026 DEBUG FromReferenceNode:51 - Resolved : student.generalEdFte -> student0_.general_ed_fte
14:24:22,069 DEBUG FromReferenceNode:51 - Resolved : student -> student0_.primary_key
14:24:22,081 DEBUG DotNode:541 - getDataType() : studentStatus -> org.hibernate.type.ManyToOneType(SOpen.spm.dao.StudentStatus)
14:24:22,095 DEBUG DotNode:348 - dereferenceEntityJoin() : generating join for studentStatus in SOpen.spm.dao.Student {no alias} parent = [ ( . ( . student0_.primary_key studentStatus ) locallyEnrolled ) ]
14:24:22,134 DEBUG FromElement:105 - FromClause{level=1} : SOpen.spm.dao.StudentStatus (no alias) -> studentsta1_
14:24:22,146 DEBUG FromClause:233 - addJoinByPathMap() : student.studentStatus -> student_status_code studentsta1_
14:24:22,158 DEBUG FromReferenceNode:51 - Resolved : student.studentStatus -> student0_.student_status_id
14:24:22,170 DEBUG DotNode:541 - getDataType() : locallyEnrolled -> org.hibernate.type.BooleanType@c7539
14:24:22,181 DEBUG FromReferenceNode:51 - Resolved : student.studentStatus.locallyEnrolled -> studentsta1_.is_locally_enrolled
14:24:22,200 DEBUG HqlSqlBaseWalker:117 - select : finishing up [level=1, statement=select]
14:24:22,213 DEBUG HqlSqlWalker:516 - processQuery() : ( SELECT ( FromClause{level=1} Student student0_ student_status_code studentsta1_ ) ( WHERE ( AND ( = ( student0_.general_ed_fte student0_.primary_key generalEdFte ) ? ) ( = ( studentsta1_.is_locally_enrolled ( student0_.student_status_id student0_.primary_key studentStatus ) locallyEnrolled ) true ) ) ) )
14:24:22,280 DEBUG HqlSqlWalker:723 - Derived SELECT clause created.
14:24:22,305 DEBUG SyntheticAndFactory:58 - Using WHERE fragment [student0_.student_status_id=studentsta1_.primary_key]
14:24:22,316 DEBUG JoinProcessor:129 - Using FROM fragment [Student student0_]
14:24:22,325 DEBUG HqlSqlBaseWalker:123 - select >> end [level=1, statement=select]
14:24:22,363 DEBUG AST:232 - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (Student,student_status_code)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'student0_.primary_key as primary1_45_' {FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=student,role=null,tableName=Student,tableAlias=student0_,origin=null,colums={,className=SOpen.spm.dao.Student}}}
| \-[SQL_TOKEN] SqlFragment: 'student0_.record_version as record2_45_, student0_.root_key as root3_45_, student0_.birth_date as birth4_45_, student0_.student_number as student5_45_, student0_.primary_gender as primary6_45_, student0_.general_ed_fte as general7_45_, student0_.first_name as first8_45_, student0_.last_name as last9_45_, student0_.middle_name as middle10_45_, student0_.generation_name as generation11_45_, student0_.home_address_id as home12_45_, student0_.home_phone as home13_45_, student0_.school_year_id as school14_45_, student0_.primary_location_id as primary15_45_, student0_.student_status_id as student16_45_, student0_.primary_ethnicity_id as primary17_45_, student0_.home_language_id as home18_45_, student0_.adult_status_id as adult19_45_, student0_.at_risk_id as at20_45_, student0_.citizenship_id as citizen21_45_, student0_.dual_enroll_id as dual22_45_, student0_.english_as_second_language_id as english23_45_, student0_.free_lunch_id as free24_45_, student0_.gifted_talented_id as gifted25_45_, student0_.homeless_id as homeless26_45_, student0_.immigrant_id as immigrant27_45_, student0_.migrant_id as migrant28_45_, student0_.limited_english_proficient_id as limited29_45_, student0_.parental_status_id as parental30_45_, student0_.title1_elig_id as title31_45_, student0_.instructional_setting_id as instruc32_45_, student0_.special_ed_code_id as special33_45_, student0_.economic_status_id as economic34_45_, student0_.attendance_eligibility_id as attendance35_45_, student0_.vocational_class_id as vocational36_45_, student0_.locker_num_id as locker37_45_, student0_.bus_route_id as bus38_45_, student0_.grade_catalog_id as grade39_45_, student0_.room_catalog_id as room40_45_, student0_.unlisted_phone as unlisted41_45_, student0_.counselor_id as counselor42_45_, student0_.teacher_of_record_id as teacher43_45_, student0_.change_reason_id as change44_45_, student0_.change_comments as change45_45_, student0_.change_effective_date as change46_45_, student0_.change_effective_through as change47_45_, student0_.snapshot_order as snapshot48_45_, student0_.GUID as GUID45_, student0_.changed_by_user as changed50_45_, student0_.changed_at as changed51_45_, student0_.created_at as created52_45_, student0_.created_by_user as created53_45_'
+-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=2, fromElements=2, fromElementByClassAlias=[student], fromElementByTableAlias=[student0_, studentsta1_], fromElementsByPath=[student.studentStatus], collectionJoinFromElementsByPath=[], impliedElements=[]}
| +-[FROM_FRAGMENT] FromElement: 'Student student0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=student,role=null,tableName=Student,tableAlias=student0_,origin=null,colums={,className=SOpen.spm.dao.Student}}
| \-[FROM_FRAGMENT] ImpliedFromElement: 'student_status_code studentsta1_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=student_status_code,tableAlias=studentsta1_,origin=Student student0_,colums={student0_.student_status_id ,className=SOpen.spm.dao.StudentStatus}}
\-[WHERE] SqlNode: 'WHERE'
+-[THETA_JOINS] SqlNode: '{theta joins}'
| \-[SQL_TOKEN] SqlFragment: 'student0_.student_status_id=studentsta1_.primary_key'
\-[AND] SqlNode: 'AND'
+-[EQ] BinaryLogicOperatorNode: '='
| +-[DOT] DotNode: 'student0_.general_ed_fte' {propertyName=generalEdFte,dereferenceType=4,propertyPath=generalEdFte,path=student.generalEdFte,tableAlias=student0_,className=SOpen.spm.dao.Student,classAlias=student}
| | +-[ALIAS_REF] IdentNode: 'student0_.primary_key' {alias=student, className=SOpen.spm.dao.Student, tableAlias=student0_}
| | \-[IDENT] IdentNode: 'generalEdFte' {originalText=generalEdFte}
| \-[PARAM] ParameterNode: '?' {ordinal=0, expectedType=org.hibernate.type.FloatType@324ff}
\-[EQ] BinaryLogicOperatorNode: '='
+-[DOT] DotNode: 'studentsta1_.is_locally_enrolled' {propertyName=locallyEnrolled,dereferenceType=4,propertyPath=locallyEnrolled,path=student.studentStatus.locallyEnrolled,tableAlias=studentsta1_,className=SOpen.spm.dao.StudentStatus,classAlias=null}
| +-[DOT] DotNode: 'student0_.student_status_id' {propertyName=studentStatus,dereferenceType=1,propertyPath=studentStatus,path=student.studentStatus,tableAlias=studentsta1_,className=SOpen.spm.dao.StudentStatus,classAlias=null}
| | +-[ALIAS_REF] IdentNode: 'student0_.primary_key' {alias=student, className=SOpen.spm.dao.Student, tableAlias=student0_}
| | \-[IDENT] IdentNode: 'studentStatus' {originalText=studentStatus}
| \-[IDENT] IdentNode: 'locallyEnrolled' {originalText=locallyEnrolled}
\-[TRUE] BooleanLiteralNode: 'true'

14:24:22,483 DEBUG ErrorCounter:68 - throwQueryException() : no errors
14:24:22,535 DEBUG QueryTranslatorImpl:216 - HQL: FROM SOpen.spm.dao.Student AS student WHERE student.generalEdFte= ? AND student.studentStatus.locallyEnrolled = TRUE
14:24:22,546 DEBUG QueryTranslatorImpl:217 - SQL: select student0_.primary_key as primary1_45_, student0_.record_version as record2_45_, student0_.root_key as root3_45_, student0_.birth_date as birth4_45_, student0_.student_number as student5_45_, student0_.primary_gender as primary6_45_, student0_.general_ed_fte as general7_45_, student0_.first_name as first8_45_, student0_.last_name as last9_45_, student0_.middle_name as middle10_45_, student0_.generation_name as generation11_45_, student0_.home_address_id as home12_45_, student0_.home_phone as home13_45_, student0_.school_year_id as school14_45_, student0_.primary_location_id as primary15_45_, student0_.student_status_id as student16_45_, student0_.primary_ethnicity_id as primary17_45_, student0_.home_language_id as home18_45_, student0_.adult_status_id as adult19_45_, student0_.at_risk_id as at20_45_, student0_.citizenship_id as citizen21_45_, student0_.dual_enroll_id as dual22_45_, student0_.english_as_second_language_id as english23_45_, student0_.free_lunch_id as free24_45_, student0_.gifted_talented_id as gifted25_45_, student0_.homeless_id as homeless26_45_, student0_.immigrant_id as immigrant27_45_, student0_.migrant_id as migrant28_45_, student0_.limited_english_proficient_id as limited29_45_, student0_.parental_status_id as parental30_45_, student0_.title1_elig_id as title31_45_, student0_.instructional_setting_id as instruc32_45_, student0_.special_ed_code_id as special33_45_, student0_.economic_status_id as economic34_45_, student0_.attendance_eligibility_id as attendance35_45_, student0_.vocational_class_id as vocational36_45_, student0_.locker_num_id as locker37_45_, student0_.bus_route_id as bus38_45_, student0_.grade_catalog_id as grade39_45_, student0_.room_catalog_id as room40_45_, student0_.unlisted_phone as unlisted41_45_, student0_.counselor_id as counselor42_45_, student0_.teacher_of_record_id as teacher43_45_, student0_.change_reason_id as change44_45_, student0_.change_comments as change45_45_, student0_.change_effective_date as change46_45_, student0_.change_effective_through as change47_45_, student0_.snapshot_order as snapshot48_45_, student0_.GUID as GUID45_, student0_.changed_by_user as changed50_45_, student0_.changed_at as changed51_45_, student0_.created_at as created52_45_, student0_.created_by_user as created53_45_ from Student student0_, student_status_code studentsta1_ where student0_.student_status_id=studentsta1_.primary_key and student0_.general_ed_fte=? and studentsta1_.is_locally_enrolled=true
14:24:22,593 DEBUG ErrorCounter:68 - throwQueryException() : no errors
14:24:22,641 DEBUG HQLQueryPlan:269 - HQL param location recognition took 14 mills (FROM Student AS student WHERE student.generalEdFte= ? AND student.studentStatus.locallyEnrolled = TRUE)


Top
 Profile  
 
 Post subject: Found the bug in hibernate ParameterParser
PostPosted: Wed Nov 08, 2006 4:33 pm 
Newbie

Joined: Wed Nov 08, 2006 1:35 pm
Posts: 4
I've think I've figured out what is going on. There is a bug in ParameterParser.parse (line 42). It checks sqlString.indexof("call"), which matches because of the 'locallyEnrolled' in my query. How do we get a fix into the code base?

Thanks,
Jason


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 5:58 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
I see the code you are referring to; it is the same in v3.1. It appears to be dealing with the output parameter for a stored procedure call.

Have you tried using a named parameter (i.e. ":myParam1") rather than an ordinal parameter?

If you really have a bug, you can open a JIRI. A simple repeatable testcase that demostrates the issue is needed. Remember this is an open source project so fixes rather than just a bug report are greatly appreciated. But any fix must pass all other testcases.

Curtis ...

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
 Post subject: Re: Found the bug in hibernate ParameterParser
PostPosted: Thu Nov 09, 2006 5:49 am 
Newbie

Joined: Thu Jun 09, 2005 11:28 am
Posts: 6
Location: Karlsruhe, Germany
jnichols wrote:
I've think I've figured out what is going on. There is a bug in ParameterParser.parse (line 42). It checks sqlString.indexof("call"), which matches because of the 'locallyEnrolled' in my query. How do we get a fix into the code base?


This is bug
http://opensource.atlassian.com/project ... e/HHH-1423
which has a patch.

Nobody seems to be interested in this.

_________________
Don't forget to rate!


Top
 Profile  
 
 Post subject: Re: ordinal parameter mistmatch
PostPosted: Mon Sep 12, 2011 2:27 pm 
Newbie

Joined: Mon Sep 12, 2011 2:09 pm
Posts: 2
Sorry about revive this topic, but I'm using 3.3.1 hibernate version (spring jar: com.springsource.org.hibernate-3.3.1.GA.jar) and this bug isn't still fixed.

I have the follow hql :

Code:
"select ... " +
"from   ... " +
"where  secContext = ? and customer = ? and " +
"        callType is null and impact is null and asset is null and reporter is null ";


I have seen that the "call" word in some position causes this bug.

If I change the "callType is null" postition comparison to begin of where clause, the hql command works!


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