I switched to using simple sets of strings rather than many to many associations because of this problem. The query (and my program) work perfectly but I really need that many to many association. When I switch back to using the many to many (its an easy change, dont even have to change the database at all) my query still runs fine and returns a list with at least one result where it should. However, whatever it's returning is mangled or not of my Scholarship object class because the jsp always chokes on it saying it cant find the getter methods. Anyone have any idea what Im getting back?
Hibernate version:
3.1 (3.0 as well)
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="edu.asu.SFAO.DAOs.Scholarship" table="scholarship" lazy="true">
<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="text" not-null="true" column="condition"> </property>
<property name="eligibility" type="text" not-null="true" column="eligibility"> </property>
<property name="description" type="text" not-null="true" column="description"> </property>
<property name="comment" type="text" 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>
<property name="contactEmail" type="string" not-null="true" column="contact_email"> </property>
<set name="campuses" table="scholarshipXcampus" cascade="all" lazy="false">
<meta attribute="field-description">
A scholarship can have many campuses associated with it
</meta>
<key column="scholarshipID" />
<many-to-many column="campusID" class="edu.asu.SFAO.DAOs.Campus" />
</set>
<set name="classstandings" table="scholarshipXclassstanding" cascade="all" lazy="false">
<meta attribute="field-description">
A scholarship can have many classstandings associated with it
</meta>
<key column="scholarshipID" />
<many-to-many column="classstandingID" class="edu.asu.SFAO.DAOs.ClassStanding" />
</set>
<set name="donorPrefs" table="scholarshipXdonorpref" cascade="all" lazy="false">
<meta attribute="field-description">
A scholarship can have many donor preferences associated with it
</meta>
<key column="scholarshipID" />
<many-to-many column="donorprefID" class="edu.asu.SFAO.DAOs.DonorPref" />
</set>
<set name="majors" table="scholarshipXmajor" cascade="all" lazy="false">
<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.getApplicableScholarships">
<![CDATA[
from edu.asu.SFAO.DAOs.Scholarship as scholarship
left join scholarship.majors as majors
left join scholarship.campuses as campuses
left join scholarship.classstandings as classstandings
where majors in (:major) and
scholarship.needBased in (:needBased) and
scholarship.azResident in (:azResident) and
classstandings = :classstanding and
campuses = :campus and
scholarship.minimumGpa <= :minimumGpa and
scholarship.minimumHours <= :minimumHours
]]>
</query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
scholarships = hibScholarshipSearchSession.getNamedQuery("edu.asu.SFAO.getApplicableScholarships")
.setParameterList("needBased",needs,Hibernate.INTEGER)
.setParameterList("azResident",res,Hibernate.INTEGER)
.setParameterList("major",majors,Hibernate.STRING)
.setInteger("classstanding",ssf.getClassstanding())
.setInteger("campus",ssf.getCampus())
.setInteger("minimumGpa",ssf.getGpa())
.setInteger("minimumHours",ssf.getMinimumHours())
.list();
Full stack trace of any exception that occurs:
12:47:44,749 ERROR [jsp]:704 - Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "scholarship"
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:986)
at org.apache.struts.taglib.TagUtils.computeParameters(TagUtils.java:188)
at org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:440)
at org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:341)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_html_link_1(org.apache.jsp.WE
B_002dINF.views.ListScholarshipsPage_jsp:537)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_c_if_1(org.apache.jsp.WEB_002
dINF.views.ListScholarshipsPage_jsp:510)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_c_forEach_0(org.apache.jsp.WE
B_002dINF.views.ListScholarshipsPage_jsp:364)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_tiles_put_4(org.apache.jsp.WE
B_002dINF.views.ListScholarshipsPage_jsp:274)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_tiles_insert_0(org.apache.jsp
.WEB_002dINF.views.ListScholarshipsPage_jsp:127)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspService(org.apache.jsp.WEB_002dINF.v
iews.ListScholarshipsPage_jsp:82)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at edu.asu.SFAO.Actions.HibernateActionServlet.doGet(HibernateActionServlet.java:199)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
12:47:44,750 ERROR [action]:253 - Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "scholarship"
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:986)
at org.apache.struts.taglib.TagUtils.computeParameters(TagUtils.java:188)
at org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:440)
at org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:341)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_html_link_1(org.apache.jsp.WE
B_002dINF.views.ListScholarshipsPage_jsp:537)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_c_if_1(org.apache.jsp.WEB_002
dINF.views.ListScholarshipsPage_jsp:510)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_c_forEach_0(org.apache.jsp.WE
B_002dINF.views.ListScholarshipsPage_jsp:364)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_tiles_put_4(org.apache.jsp.WE
B_002dINF.views.ListScholarshipsPage_jsp:274)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspx_meth_tiles_insert_0(org.apache.jsp
.WEB_002dINF.views.ListScholarshipsPage_jsp:127)
at org.apache.jsp.WEB_002dINF.views.ListScholarshipsPage_jsp._jspService(org.apache.jsp.WEB_002dINF.v
iews.ListScholarshipsPage_jsp:82)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at edu.asu.SFAO.Actions.HibernateActionServlet.doGet(HibernateActionServlet.java:199)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Name and version of the database you are using:
MS SQL (not sure)
The generated SQL (show_sql=true):12:47:44,452 DEBUG SQL:346 - select scholarshi0_.scholarshipID as scholars1_3_0_, campus3_.campusID as campus
ID0_1_, classstand5_.classstandingID as classsta1_1_2_, scholarshi0_.name as name3_0_, scholarshi0_.amount_ty
pe as amount3_3_0_, scholarshi0_.amount as amount3_0_, scholarshi0_.activation_date as activation5_3_0_, scho
larshi0_.deadline_date as deadline6_3_0_, scholarshi0_.open_deadline as open7_3_0_, scholarshi0_.application_
url as applicat8_3_0_, scholarshi0_.need_based as need9_3_0_, scholarshi0_.global_list as global10_3_0_, scho
larshi0_.minimum_gpa as minimum11_3_0_, scholarshi0_.minimum_hours as minimum12_3_0_, scholarshi0_.az_residen
t as az13_3_0_, scholarshi0_.condition as condition3_0_, scholarshi0_.eligibility as eligibi15_3_0_, scholars
hi0_.description as descrip16_3_0_, scholarshi0_.comment as comment3_0_, scholarshi0_.contact_name as contact
18_3_0_, scholarshi0_.contact_organization as contact19_3_0_, scholarshi0_.contact_phone as contact20_3_0_, s
cholarshi0_.contact_email as contact21_3_0_, campus3_.name as name0_1_, campus3_.ordering as ordering0_1_, cl
assstand5_.name as name1_2_, classstand5_.ordering as ordering1_2_ from scholarship scholarshi0_ left outer j
oin scholarshipXmajor majors1_ on scholarshi0_.scholarshipID=majors1_.scholarshipID left outer join scholarsh
ipXcampus campuses2_ on scholarshi0_.scholarshipID=campuses2_.scholarshipID left outer join campus campus3_ o
n campuses2_.campusID=campus3_.campusID left outer join scholarshipXclassstanding classstand4_ on scholarshi0
_.scholarshipID=classstand4_.scholarshipID left outer join classstanding classstand5_ on classstand4_.classst
andingID=classstand5_.classstandingID where (majors1_.majorCode in (?)) and (scholarshi0_.need_based in (? ,
? , ?)) and (scholarshi0_.az_resident in (? , ? , ?)) and classstand5_.classstandingID=? and campus3_.campusI
D=? and scholarshi0_.minimum_gpa<=? and scholarshi0_.minimum_hours<=?
12:47:44,462 DEBUG SQL:346 - select majors0_.scholarshipID as scholars1_0_, majors0_.majorCode as majorCode0_
from scholarshipXmajor majors0_ where majors0_.scholarshipID=?
12:47:44,465 DEBUG SQL:346 - select donorprefs0_.scholarshipID as scholars1_1_, donorprefs0_.donorprefID as d
onorpre2_1_, donorpref1_.donorprefID as donorpre1_2_0_, donorpref1_.name as name2_0_, donorpref1_.ordering as
ordering2_0_ from scholarshipXdonorpref donorprefs0_ left outer join donorpref donorpref1_ on donorprefs0_.d
onorprefID=donorpref1_.donorprefID where donorprefs0_.scholarshipID=?
12:47:44,475 DEBUG SQL:346 - select classstand0_.scholarshipID as scholars1_1_, classstand0_.classstandingID
as classsta2_1_, classstand1_.classstandingID as classsta1_1_0_, classstand1_.name as name1_0_, classstand1_.
ordering as ordering1_0_ from scholarshipXclassstanding classstand0_ left outer join classstanding classstand
1_ on classstand0_.classstandingID=classstand1_.classstandingID where classstand0_.scholarshipID=?
12:47:44,741 DEBUG SQL:346 - select campuses0_.scholarshipID as scholars1_1_, campuses0_.campusID as campusID
1_, campus1_.campusID as campusID0_0_, campus1_.name as name0_0_, campus1_.ordering as ordering0_0_ from scho
larshipXcampus campuses0_ left outer join campus campus1_ on campuses0_.campusID=campus1_.campusID where camp
uses0_.scholarshipID=?
|