2016-07-07 13 views
0

データベースのテーブルから最初の10行を取得する簡単なHQLクエリを作成しました。私はオブジェクトのリストからデータを印刷することができます。Java/Hibernate HQLがヌルエラーを返すテーブルクエリからローを取得する

このコードは、#{HomeController.results}というHTMLで呼び出されます。その後、ログリストはHome Controllerクラスに戻されます。私が試してみて、私は簡単なことだろうと思った他のクエリを実行するたびに

String queryString = "FROM Log"; 
Query query = entity.createQuery(queryString); 
query.setMaxResults(10); 

List<Log> results = query.getResultList(); 

は残念ながら、それはフリークアウトし、nullポインタまたは境界エラーの外をスローします。

たとえば、しようとする代わりに、最後の10行を取得するには、リストの順序を変更:HTMLは、最初のプロパティを(すべての行がbatchIdを持っている)にアクセスしようとしたとき

String queryString = "FROM Log ORDER BY batchId DESC"; 

はnullポインタエラーを与えます。

か試してみて、今週から行を取得するには:

String queryString = "FROM Log x WHERE to_char(x.logDate, 'WW/YYYY') = 
        to_char(current_date, 'WW/YYYY')"; 

があまりにも最初のプロパティの境界の外のインデックスを与えます。私は間違って簡単なことをしているに違いないと思います。 REQUEST UPON

EDIT:

HTML:

<!-- get table from database, returns size of results list --> 
Results: <h:outputText value="#{homeController.results}" /> 

<br></br> 
BatchId: <h:outputText value="#{homeController.batchId}" /> 
RecordId: <h:outputText value="#{homeController.recordId}" /> 
UnitName: <h:outputText value="#{homeController.unitName}" /> 
LogDate: <h:outputText value="#{homeController.logDate}" /> 
LogFlag: <h:outputText value="#{homeController.logFlag}" /> 
LogFields: <h:outputText value="#{homeController.logFields}" /> 
LogReason: <h:outputText value="#{homeController.logReason}" /> 
ProcessGroup: <h:outputText value="#{homeController.processGroup}" /> 
<!-- iterate next row --> 
<h:outputText value="#{homeController.row}" /> 

ログイン豆:

@Entity 
@IdClass(Log.class) 
@Audited 
@Table(name = "log") 
public class Log implements Serializable { 

private static final long serialVersionUID = 3258748209780261981L; 
private Integer batchId; 
private Integer recordId; 
private String unitName; 
private Date logDate; 
private String logFlag; 
private String logFields; 
private String logReason; 
private String processGroup; 

// batchId AND processGroup is composite primary key!! 
// equals and hashCode methods necessary for implementing composite key! 
@Override 
public int hashCode() { 
    final int prime = 31; 
    int result = 1; 
    result = prime * result 
      + ((batchId == null) ? 0 : batchId.hashCode()); 
    result = prime * result 
      + ((processGroup == null) ? 0 : processGroup.hashCode()); 
    return result; 
} 
@Override 
public boolean equals(Object obj) { 
    if (this == obj) 
     return true; 
    if (obj == null) 
     return false; 
    if (!(obj instanceof Log)) 
     return false; 
    Log other = (Log) obj; 
    if (batchId == null) { 
     if (other.batchId != null) 
      return false; 
    } else if (!batchId.equals(other.batchId)) 
     return false; 
    if (processGroup == null) { 
     if (other.processGroup != null) 
      return false; 
    } else if (!processGroup.equals(other.processGroup)) 
     return false; 
    return true; 
} 


@Id 
@Column(name = "BATCH_ID") 
public Integer getBatchId() { 
    return batchId; 
} 
public void setBatchId(Integer batch_id) { 
    this.batchId = batch_id; 
} 

@Column(name = "RECORD_ID") 
public Integer getRecordId() { 
    return recordId; 
} 
public void setRecordId(Integer record_id) { 
    this.recordId = record_id; 
} 

@Column(name = "UNIT_NAME") 
public String getUnitName() { 
    return unitName; 
} 
public void setUnitName(String unit_name) { 
    this.unitName = unit_name; 
} 

@Column(name = "LOG_DATE") 
public Date getLogDate() { 
    return logDate; 
} 
public void setLogDate(Date log_date) { 
    this.logDate = log_date; 
} 

@Column(name = "LOG_FLAG") 
public String getLogFlag() { 
    return logFlag; 
} 
public void setLogFlag(String log_flag) { 
    this.logFlag = log_flag; 
} 

@Column(name = "LOG_FIELDS") 
public String getLogFields() { 
    return logFields; 
} 
public void setLogFields(String log_fields) { 
    this.logFields = log_fields; 
} 

@Column(name = "LOG_REASON") 
public String getLogReason() { 
    return logReason; 
} 
public void setLogReason(String log_reason) { 
    this.logReason = log_reason; 
} 

@Id 
@Column(name = "PROCESSGROUP") 
public String getProcessGroup() { 
    return processGroup; 
} 
public void setProcessGroup(String processgroup) { 
    this.processGroup = processgroup; 
} 

} 

ホームコントローラ:

@Named 
@RequestScoped // must be properly scoped to maintain resultsList 
public class HomeController implements Serializable { 

    private static final long serialVersionUID = 6700905317429809540L; 
    private static List<Log> resultsList; 
    private static Integer row = 0; 

    private String message = "Hello World"; 
    private String results = "NULL", 
        batchId = "NULL", 
        recordId = "NULL", 
        unitName = "NULL", 
        logDate = "NULL", 
        logFlag = "NULL", 
        logFields = "NULL", 
        logReason = "NULL", 
        processGroup = "NULL"; 

    @Inject 
    ReferenceDataService referenceDataService; 

    // retrieves rows from HubToBauExceptionLog from database and assigns to resultsList 
    // return string of resultList size 
    public String getResults() 
    { 
     setResults(""); 
     return results; 
    } 
    public void setResults(String input) 
    { 
     resultsList = referenceDataService.retrievePlantMappings(); 
     row = 0; // reset row to start 
     this.results = "" + resultsList.size(); 
    } 

    // iterate and return row number from resultsList 
    public String getRow() 
    { 
     setRow(""); 
     return ""; 
    } 
    public void setRow(String input) 
    { 
     row++; 
    } 

    // returns batchId from current resultsList row 
    public String getBatchId() 
    { 
     setBatchId(""); 
     return batchId; 
    } 
    public void setBatchId(String input) 
    { 
     if (resultsList.get(row).getBatchId() != null) 
     { 
      this.batchId = resultsList.get(row).getBatchId().toString(); 
     } 
    } 

    // returns recordId from current resultsList row 
    public String getRecordId() 
    { 
     setRecordId(""); 
     return recordId; 
    } 
    public void setRecordId(String input) 
    { 
     if (resultsList.get(row).getRecordId() != null) 
     { 
      this.recordId = resultsList.get(row).getRecordId().toString(); 
     } 
    } 

    // returns unitName from current resultsList row 
    public String getUnitName() 
    { 
     setUnitName(""); 
     return unitName; 
    } 
    public void setUnitName(String input) 
    { 
     if (resultsList.get(row).getUnitName() != null) 
     { 
      this.unitName = resultsList.get(row).getUnitName().toString(); 
     } 
    } 

    // returns logDate from current resultsList row 
    public String getLogDate() 
    { 
     setLogDate(""); 
     return logDate; 
    } 
    public void setLogDate(String input) 
    { 
     if (resultsList.get(row).getLogDate() != null) 
     { 
      this.logDate = resultsList.get(row).getLogDate().toString(); 
     } 
    } 

    // returns logFlag from current resultsList row 
    public String getLogFlag() 
    { 
     setLogFlag(""); 
     return logFlag; 
    } 
    public void setLogFlag(String input) 
    { 
     if (resultsList.get(row).getLogFlag() != null) 
     { 
      this.logFlag = resultsList.get(row).getLogFlag().toString(); 
     } 
    } 

    // returns logFields from current resultsList row 
    public String getLogFields() 
    { 
     setLogFields(""); 
     return logFields; 
    } 
    public void setLogFields(String input) 
    { 
     if (resultsList.get(row).getLogFields() != null) 
     { 
      this.logFields = resultsList.get(row).getLogFields().toString(); 
     } 
    } 

    // returns logReason from current resultsList row 
    public String getLogReason() 
    { 
     setLogReason(""); 
     return logReason; 
    } 
    public void setLogReason(String input) 
    { 
     if (resultsList.get(row).getLogReason() != null) 
     { 
      this.logReason = resultsList.get(row).getLogReason().toString(); 
     } 
    } 

    // returns processGroup from current resultsList row 
    public String getProcessGroup() 
    { 
     setProcessGroup(""); 
     return processGroup; 
    } 
    public void setProcessGroup(String input) 
    { 
     if (resultsList.get(row).getProcessGroup() != null) 
     { 
      this.processGroup = resultsList.get(row).getProcessGroup().toString(); 
     } 
    } 

} 

エラー出力:

17:00:30,502 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "x.war" 
17:00:30,502 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "xx.war" 
17:00:30,502 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report 
JBAS014777: Services which failed to start:  service jboss.deployment.unit."x.war".component.databaseMigrator.START: org.jboss.msc.service.StartException in service jboss.deployment.unit."x.war".component.databaseMigrator.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance 

17:00:30,596 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management 
17:00:30,596 INFO [org.jboss.as] (Controller Boot Thread) JBAS015954: Admin console is not enabled 
17:00:30,596 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss EAP 6.0.1.GA (AS 7.1.3.Final-redhat-4) started (with errors) in 21869ms - Started 1294 of 1383 services (3 services failed or missing dependencies, 84 services are passive or on-demand) 
17:00:32,049 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost/127.0.0.1:8080-1) Error Rendering View[/views/home.xhtml]: javax.el.ELException: /views/home.xhtml @37,66 value="#{homeController.batchId}": java.lang.NullPointerException 
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIOutput.getValue(UIOutput.java:174) [jsf-api-2.2.10.jar:2.2] 
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jsf-api-2.2.10.jar:2.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:88) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeContent(FieldsetRenderer.java:94) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeMarkup(FieldsetRenderer.java:76) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeEnd(FieldsetRenderer.java:47) [primefaces-5.2.1.jar:5.2.1] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) [jsf-api-2.2.10.jar:2.2] 
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jsf-api-2.2.10.jar:2.2] 
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) [jsf-api-2.2.10.jar:2.2] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:100) [primefaces-5.2.1.jar:5.2.1] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.10.Final-redhat-1.jar:1.1.10.Final-redhat-1] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4] 
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4] 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_30] 
Caused by: javax.el.ELException: java.lang.NullPointerException 
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:307) [jboss-el-api_2.2_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] 
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.2.10.jar:2.2.10] 
    at org.apache.el.parser.AstValue.getValue(AstValue.java:169) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-1.1.10.Final-redhat-1.jar:1.1.10.Final-redhat-1] 
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.2.10.jar:2.2.10] 
    ... 48 more 
Caused by: java.lang.NullPointerException 
    at xx.controller.HomeController.setBatchId(HomeController.java:70) [classes:] 
    at xx.controller.HomeController.getBatchId(HomeController.java:65) [classes:] 
    at xx.controller.HomeController$Proxy$_$$_WeldClientProxy.getBatchId(HomeController$Proxy$_$$_WeldClientProxy.java) [classes:] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_30] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.6.0_30] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.6.0_30] 
    at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.6.0_30] 
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:302) [jboss-el-api_2.2_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] 
    ... 54 more 

17:00:32,066 SEVERE [org.primefaces.application.exceptionhandler.PrimeExceptionHandler] (http-localhost/127.0.0.1:8080-1) null: java.lang.NullPointerException 
    at xx.controller.HomeController.setBatchId(HomeController.java:70) [classes:] 
    at xx.controller.HomeController.getBatchId(HomeController.java:65) [classes:] 
    at xx.controller.HomeController$Proxy$_$$_WeldClientProxy.getBatchId(HomeController$Proxy$_$$_WeldClientProxy.java) [classes:] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_30] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.6.0_30] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.6.0_30] 
    at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.6.0_30] 
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:302) [jboss-el-api_2.2_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] 
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.2.10.jar:2.2.10] 
    at org.apache.el.parser.AstValue.getValue(AstValue.java:169) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-1.1.10.Final-redhat-1.jar:1.1.10.Final-redhat-1] 
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIOutput.getValue(UIOutput.java:174) [jsf-api-2.2.10.jar:2.2] 
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jsf-api-2.2.10.jar:2.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:88) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeContent(FieldsetRenderer.java:94) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeMarkup(FieldsetRenderer.java:76) [primefaces-5.2.1.jar:5.2.1] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeEnd(FieldsetRenderer.java:47) [primefaces-5.2.1.jar:5.2.1] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) [jsf-api-2.2.10.jar:2.2] 
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jsf-api-2.2.10.jar:2.2] 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jsf-api-2.2.10.jar:2.2] 
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.10.jar:2.2.10] 
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) [jsf-impl-2.2.10.jar:2.2.10] 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) [jsf-api-2.2.10.jar:2.2] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:100) [primefaces-5.2.1.jar:5.2.1] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.10.Final-redhat-1.jar:1.1.10.Final-redhat-1] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4] 
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4] 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final-redhat-1.jar:] 
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_30] 
+0

コードはありません。スタックトレースはありません。どうすればお手伝いできますか? HQLはSQLと同じものだと思われるようです。そうではありません。 to_charはSQL関数であり、HQL関数ではありません。ユーザーマニュアルのJPQLとHQLの章を読んでください。 –

+0

あなたはすでにto_charがSQLのみであることに言及して助けてくれました!コードとエラートレースが追加されました。 – inappropriateCode

答えて

0

あなたのクエリから取得した値でBeanのbatchId、recordIdなどのプロパティを設定するロジックが不足しているようです。クエリはどこで実行されますか?何か不足しているロジックがあるように見えます。 Beanのプロパティは、クエリの結果と決して値が設定されず、クエリが実行されないようです。

+0

申し訳ありませんが、結果リストを呼び出す最初のコードとホームコントローラークラスに転送されるコードの関係を定義できませんでした。それはHTMLの "結果"呼び出しで起こります。私は質問を編集しました。 – inappropriateCode

+0

getResults()が呼び出された場合、現在結果を「」に設定しています。それ以来、変更や更新はありますか? –

+0

私は考えることができますか?私はそれを説明するために何か他のものがなければならないと言っていますか? "FROM Log"というクエリに戻ってきたら、上位10行を完璧に印刷しますが、下から上にリストするような単純なものを試すときは、さまざまなnullポインタエラーが出力されます。 – inappropriateCode

関連する問題