在HQL中启用/审核创建日期/时间

时间:2018-10-27 15:31:51

标签: java hql hibernate-envers

我有这个NNT:

<table border="1">
    <tr>
        <th>Subject</th>
        <th>Sender</th>
        <th>Arrived</th>
    </tr>
    {{for ms = SELECT em.subject.subject as sd, em.id as emid FROM EMail em LEFT JOIN em.inFolders f WHERE f.owner.id=:accountid AND f.id=:mf}}
        <tr>
            <td>{{sd}}</td>
            <td>
                {{for s = SELECT a.localName.localName as l, a.domain.domainName as d FROM EMailAddress a LEFT JOIN a.sent s WHERE s.id=:emid}}
                    <tt>{{l}}@{{d}}</tt>
                {{/for}}
            </td>
        </tr>
    {{/for}}
</table>

如何获取HQL中电子邮件(em)的INSERT声明的创建日期/时间?

我期望这样的事情:

 SELECT CREATED(em) FROM EMail em LEFT JOIN em.inFolders f WHERE ...

但是它把我扔了

WARN: [DEPRECATION] Encountered positional parameter near line 1, column 135 in HQL: [ SELECT em.subject.subject as sd, em.id as emid, created(em) as cd FROM EMail em LEFT JOIN em.inFolders f WHERE f.owner.id=? AND f.id=?].  Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
NO JPQL FROM  SELECT em.subject.subject as sd, em.id as emid, created(em) as cd FROM EMail em LEFT JOIN em.inFolders f WHERE f.owner.id=? AND f.id=? BECAUSE No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode
 \-[METHOD_CALL] MethodNode: '('
    +-[METHOD_NAME] IdentNode: 'created' {originalText=created}
    \-[EXPR_LIST] SqlNode: 'exprList'
       \-[ALIAS_REF] IdentNode: 'email0_.id' {alias=em, className=EMail, tableAlias=email0_}
 [ SELECT em.subject.subject as sd, em.id as emid, created(em) as cd FROM EMail em LEFT JOIN em.inFolders f WHERE f.owner.id=? AND f.id=?]

0 个答案:

没有答案