简体   繁体   English

无法在GAE上的Hibernate Query Fetch中查看字段的值

[英]Cannot view values for the fields in Hibernate Query Fetch on GAE

Cannot view values for the fields in Hibernate Query Fetch on GAE. 无法在GAE上的“休眠查询提取”中查看字段的值。

Query query  = session.createSQLQuery("select s.id,e.firstName, e.middleName, e.lastName, es.title as empStatusTitle,e.transportMode as trModeId," +
        " tr.title as trMode" +
        " from SecurityPrincipals as s " +
        " left join Employee as e on e.userId=s.id " +                  
        " left join EmployeeStatus as es on e.employeeStatus = es.id " +        
        " left join TransportationModes as tr on e.transportMode = tr.id " +                    
        " where s.id= :userId").setResultTransformer(new AliasToBeanResultTransformer(EmployeeDTO.class));

query.setParameter("userId", userId);

When I call employeeDTO.getTrMode(),employeeDTO.getEmpStatusTitle got all values correctly and running properly in local machine.But when I try to deploy on GAE the value is not getting in the view.jsf but it is there when running locally.I have getters and setters for all these in EmployeeDTO.java. 当我调用employeeDTO.getTrMode()时,employeeDTO.getEmpStatusTitle可以正确获取所有值并在本地计算机上正常运行。但是当我尝试在GAE上进行部署时,该值未进入view.jsf,但在本地运行时该值已经存在。在EmployeeDTO.java中具有所有这些的getter和setter。 All others like firstName,middleName,lastName has no problem. 所有其他名字,例如firstName,middleName,lastName都没有问题。

My employeeView.jsf is : 我的employeeView.jsf是:

<h:outputText value="Transport Mode" />
<h:outputText id="transportMode" value="#{employeeView.employeeDTO.trMode}" style="font-weight:bold" />

<h:outputText value="Employee Status" />
<h:outputText id="employeeStatus" value="#{employeeView.employeeDTO.empStatusTitle}" style="font-weight:bold" />

Since it all works locally, then your code and query are probably fine. 由于它们都在本地工作,因此您的代码和查询可能很好。 And since it does not work on GAE, then there is probably something environmental that's different. 而且由于它不适用于GAE,因此可能在环境方面有所不同。 The database is different or not configured properly. 数据库不同或配置不正确。 You should put some error checking code in to make sure the query is actually working. 您应该放入一些错误检查代码,以确保查询确实有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM