【问题标题】:using list to map tables in HQL在 HQL 中使用列表映射表
【发布时间】:2014-07-22 03:53:49
【问题描述】:

我使用 HQL 在报表应用程序中创建查询,我的查询如下所示:

from Identity i, Bundle b, IdentityBundles aib
           WHERE b.name LIKE 'DYP%' AND i.bundleSummary LIKE 'DYP%' 
           AND i.id = aib.identityId AND b.id = aib.bundle

当我尝试运行此查询时出现下一个错误:

IdentityBundles is not mapped [select count(*) from sailpoint.object.Identity i, sailpoint.object.Bundle b, IdentityBundles aib

好像没有映射到 IdentityBundles

我在应用程序的 jar 文件中注意到的唯一想法是这个列表名称(在 Identity.hbm.xml 文件中创建)具有来自表 IdentityBundles 的属性

 list name="bundles" table="IdentityBundles"
   cascade="persist,merge,save-update">
   key column="identityId"
   list-index column="idx"
   many-to-many column="bundle" class="sailpoint.object.Bundle"
 list

我可以使用这个列表来映射表格还是需要创建类和 hbm.xml 文件??

【问题讨论】:

    标签: hql


    【解决方案1】:

    Hibernate 使用映射。您正在尝试指定连接,并且由于这些连接已经映射到您的域对象中,因此您无需执行此操作。改为使用域对象属性,Hibernate 将为您获取它们。

    from Identity i 
        join i.bundles b
        where b.name like ...
    

    等等

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-16
      • 1970-01-01
      • 1970-01-01
      • 2013-05-09
      • 2011-08-01
      • 2021-09-14
      • 2013-11-01
      相关资源
      最近更新 更多