无法在GAE上查看Hibernate Query Fetch中字段的值。
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);
当我调用employeeDTO.getTrMode()时,employeeDTO.getEmpStatusTitle正确地获取了所有值并在本地机器上正常运行。但是当我尝试在GAE上部署时,值没有进入view.jsf,但是在运行时它就在那里local.I在EmployeeDTO.java中有所有这些的getter和setter。所有其他像firstName,middleName,lastName没有问题。
我的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" />
答案 0 :(得分:0)
由于它都在本地运行,因此您的代码和查询可能很好。由于它不适用于GAE,因此可能存在一些不同的环境。数据库不同或配置不正确。您应该输入一些错误检查代码以确保查询实际正常工作。