Query using alias on column give an error

前端 未结 1 900
[愿得一人]
[愿得一人] 2021-01-13 08:58

When i use alias for column i get error. Without alias everytinig works good. What is the problem with that ? This is simple example, but need to use more aliases in real pr

相关标签:
1条回答
  • 2021-01-13 09:55

    If your "product" is mapped, hibernate probably don't know about "myId" and therefore can't select it. You can try something like:

    getSession().createSQLQuery(sql).addScalar("myId", Hibernate.LONG)
    
    0 讨论(0)
提交回复
热议问题