0

HQL (選択) で必要なフィールドを指定しようとしていました。しかし、これを行うと、この奇妙な問題が発生し続けます。

エラーメッセージ

java.lang.NumberFormatException: For input string: "staffId"
    java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    java.lang.Integer.parseInt(Integer.java:492)
    java.lang.Integer.parseInt(Integer.java:527)
    javax.el.ArrayELResolver.coerce(ArrayELResolver.java:166)
    javax.el.ArrayELResolver.getValue(ArrayELResolver.java:46)
    org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:104)
    org.apache.el.parser.AstValue.getValue(AstValue.java:183)
    org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
    org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:1026)
    org.apache.jsp.views.search.SearchResults_jsp._jspx_meth_c_005fforEach_005f0(SearchResults_jsp.java:209)
    org.apache.jsp.views.search.SearchResults_jsp._jspx_meth_c_005fif_005f0(SearchResults_jsp.java:165)
    org.apache.jsp.views.search.SearchResults_jsp._jspService(SearchResults_jsp.java:96)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
    org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
    org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
    org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
    org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
    org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
    org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
    org.apache.tiles.renderer.impl.ChainedDelegateAttributeRenderer.write(ChainedDelegateAttributeRenderer.java:76)
    org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:336)
    org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:210)
    org.apache.tiles.template.InsertAttributeModel.end(InsertAttributeModel.java:126)
    org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:311)
    org.apache.jsp.views.templates.Layout_jsp._jspx_meth_tiles_005finsertAttribute_005f2(Layout_jsp.java:344)
    org.apache.jsp.views.templates.Layout_jsp._jspService(Layout_jsp.java:182)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)
    org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:222)
    org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
    org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:690)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:627)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
    org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:124)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

私のHQL(ご覧のとおり、現在、エラーが発生するものに設定されていますが、コメントアウトされたものは正常に機能します)

    //SQL = "from Staff where (surnameSearch is not null) and not (nvl(teleDirectory,'xxx') IN ('N','S','D')) and not (telephoneNumber IS NULL AND alias IS NULL) and (aliasList = 'Y' OR (teleDirectory IN ('A','B'))) and ((nvl(systemIdEnd,sysdate+1) > SYSDATE and entityType = 'P') or (entityType = 'N')) and (departmentSearch NOT like 'SPONSOR%')";
    SQL = "select staffId, parentId, entityType, title, firstname, surname, telephoneNumber, department, role from Staff where (surnameSearch is not null) and not (nvl(teleDirectory,'xxx') IN ('N','S','D')) and not (telephoneNumber IS NULL AND alias IS NULL) and (aliasList = 'Y' OR (teleDirectory IN ('A','B'))) and ((nvl(systemIdEnd,sysdate+1) > SYSDATE and entityType = 'P') or (entityType = 'N')) and (departmentSearch NOT like 'SPONSOR%')";

私も運なしでこれを試しました。

    SQL = "select staff.staffId, staff.parentId, staff.entityType, staff.title, staff.firstname, staff.surname, staff.telephoneNumber, staff.department, staff.role from Staff staff where (surnameSearch is not null) and not (nvl(teleDirectory,'xxx') IN ('N','S','D')) and not (telephoneNumber IS NULL AND alias IS NULL) and (aliasList = 'Y' OR (teleDirectory IN ('A','B'))) and ((nvl(systemIdEnd,sysdate+1) > SYSDATE and entityType = 'P') or (entityType = 'N')) and (departmentSearch NOT like 'SPONSOR%')";

私のモデルクラスのスニペット

public class Staff {
    Integer pk;
    String staffId;
    String parentId;
    String entityType;
    String title;
    String firstname;
    String surname;
    String telephoneNumber;
    String department;
    String role;

    String alias;
    String aliasList;
    String departmentSearch;
    String firstnameSearch;
    String roleSearch;
    String surnameSearch;
    String surnameLikeSearch;
    Date systemIdEnd;
    String teleDirectory;

    public Integer getPk() {
        return pk;
    }
    public void setPk(Integer pk) {
        this.pk = pk;
    }

    public String getStaffId() {
        return staffId;
    }
    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }

私の hbm XML のスニペット

<hibernate-mapping>
    <class name="org.flinders.staffdirectory.models.database.Staff" table="teld_summary">
        <id name="pk" column="telsumm_pk" />
        <property name="staffId" column="telsumm_id" />

Oracle DB を調べたところ、「staffId」が実際に文字列 (または私の場合は varchar2) であることを確認しました。

助けていただけますか?ありがとう

4

1 に答える 1

0

staffid列にマッピングしましたtelsumm_id:

<property name="staffId" column="telsumm_id" />

telsumm_idその名前が「_id」で終わることを考えると、それは整数列である可能性があります

于 2012-12-08T06:01:46.400 に答える