I can search within the properties of the scholarship table just fine but queries into any of the sets arent working. Anyone know why?
Hibernate version:
hibernate-3.0.5
Mapping documents:
<hibernate-mapping>
<class name="edu.asu.SFAO.DAOs.Scholarship" table="scholarship">
<meta attribute="class-description">
A representation of an ASU scholarship
</meta>
<id name="id" column="scholarshipID" unsaved-value="0" >
<meta attribute="scope-set">protected</meta>
<generator class="native"> </generator>
</id>
<property name="name" type="string" not-null="true" column="name"> </property>
<property name="amountType" type="int" not-null="true" column="amount_type"> </property>
<property name="amount" type="int" not-null="true" column="amount"> </property>
<property name="activationDate" type="string" not-null="true" column="activation_date"> </property>
<property name="deadlineDate" type="string" not-null="true" column="deadline_date"> </property>
<property name="openDeadline" type="int" not-null="true" column="open_deadline"> </property>
<property name="applicationUrl" type="string" not-null="true" column="application_url"> </property>
<property name="needBased" type="int" not-null="true" column="need_based"> </property>
<property name="globalList" type="int" not-null="true" column="global_list"> </property>
<property name="minimumGpa" type="int" not-null="true" column="minimum_gpa"> </property>
<property name="minimumHours" type="int" not-null="true" column="minimum_hours"> </property>
<property name="azResident" type="int" not-null="true" column="az_resident"> </property>
<property name="condition" type="string" not-null="true" column="condition"> </property>
<property name="eligibility" type="string" not-null="true" column="eligibility"> </property>
<property name="description" type="string" not-null="true" column="description"> </property>
<property name="comment" type="string" not-null="true" column="comment"> </property>
<property name="contactName" type="string" not-null="true" column="contact_name"> </property>
<property name="contactOrganization" type="string" not-null="true" column="contact_organization"> </property>
<property name="contactPhone" type="string" not-null="true" column="contact_phone"> </property>
<set name="campuses" table="scholarshipXcampus" inverse="false" cascade="all">
<meta attribute="field-description">
A scholarship can have many majors associated with it
</meta>
<key column="scholarshipID"/>
<element column="campusID" type="integer"/>
</set>
<set name="classstandings" table="scholarshipXclassstanding" inverse="false" cascade="all">
<meta attribute="field-description">
A scholarship can have many classstandings associated with it
</meta>
<key column="scholarshipID" />
<element column="classstandingID" type="integer"/>
</set>
<set name="donorPrefs" table="scholarshipXdonorpref" inverse="false" cascade="all">
<meta attribute="field-description">
A scholarship can have many donor preferences associated with it
</meta>
<key column="scholarshipID" />
<element column="donorprefID" type="integer"/>
</set>
<set name="majors" table="scholarshipXmajor" inverse="false" cascade="all">
<meta attribute="field-description">
A scholarship can have many majors associated with it
</meta>
<key column="scholarshipID"/>
<element column="majorCode" type="string"/>
</set>
</class>
<query name="edu.asu.SFAO.getAllScholarships" >
<![CDATA[
from edu.asu.SFAO.DAOs.Scholarship as scholarship
order by scholarship.deadlineDate ASC
]]>
</query>
<query name="edu.asu.SFAO.getGlobalScholarships">
<![CDATA[
from edu.asu.SFAO.DAOs.Scholarship as scholarship
where scholarship.globalList=1
order by scholarship.deadlineDate ASC
]]>
</query>
<query name="edu.asu.SFAO.getActiveScholarships">
<![CDATA[
from edu.asu.SFAO.DAOs.Scholarship as scholarship
where scholarship.activationDate <= :today and scholarship.deadlineDate >= :today
order by scholarship.deadlineDate ASC
]]>
</query>
<query name="edu.asu.SFAO.getSpecificScholarship">
<![CDATA[
from edu.asu.SFAO.DAOs.Scholarship as scholarship
where scholarship.id = :id
]]>
</query>
<query name="edu.asu.SFAO.getApplicableScholarships">
<![CDATA[
from edu.asu.SFAO.DAOs.Scholarship as scholarship
where scholarship.donorPrefs = :donorPrefs
]]>
</query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
hibScholarshipSearchSession = sessionFactory1.openSession();
scholarships = hibScholarshipSearchSession.getNamedQuery("edu.asu.SFAO.getApplicableScholarships")
.setInteger("donorPrefs",1)
.list();
Name and version of the database you are using:
ms sql (not sure of version)
The generated SQL (show_sql=true):
11:43:56,196 DEBUG SQL:324 - select scholarshi0_.scholarshipID as scholars1_, scholarshi0_.name as name3
_, scholarshi0_.amount_type as amount3_3_, scholarshi0_.amount as amount3_, scholarshi0_.activation_date
as activation5_3_, scholarshi0_.deadline_date as deadline6_3_, scholarshi0_.open_deadline as open7_3_,
scholarshi0_.application_url as applicat8_3_, scholarshi0_.need_based as need9_3_, scholarshi0_.global_l
ist as global10_3_, scholarshi0_.minimum_gpa as minimum11_3_, scholarshi0_.minimum_hours as minimum12_3_
, scholarshi0_.az_resident as az13_3_, scholarshi0_.condition as condition3_, scholarshi0_.eligibility a
s eligibi15_3_, scholarshi0_.description as descrip16_3_, scholarshi0_.comment as comment3_, scholarshi0
_.contact_name as contact18_3_, scholarshi0_.contact_organization as contact19_3_, scholarshi0_.contact_
phone as contact20_3_ from scholarship scholarshi0_, scholarshipXdonorpref donorprefs1_ where scholarshi
0_.scholarshipID=donorprefs1_.scholarshipID and .=?
Debug level Hibernate log excerpt:
11:43:56,387 WARN JDBCExceptionReporter:71 - SQL Error: 170, SQLState: 37000
11:43:56,389 ERROR JDBCExceptionReporter:72 - Line 1: Incorrect syntax near '='.
11:43:56,396 WARN JDBCExceptionReporter:48 - SQL Warning: 170, SQLState: 37000
11:43:56,397 WARN JDBCExceptionReporter:49 - Preparing the statement failed: Line 1: Incorrect syntax n
|