【问题标题】:Hibernate hbm xml mapping of non-existing property不存在属性的休眠 hbm xml 映射
【发布时间】:2014-05-15 14:12:07
【问题描述】:

是否可以在 Hibernate xml 映射中使用不存在的属性?

<property name="nonExisting" type="java.lang.String" column="nonExisting"/>

所以我可以在我的数据库中拥有nonExisting 列,但不能在我的班级中。我还需要对该列使用 Hibernate 标准。

【问题讨论】:

    标签: hibernate orm hibernate-mapping hbm


    【解决方案1】:

    您可以在 xml 文件中编写命名查询:

    经验:

    <sql-query name="named.query" >
        <return alias="b" class="com.classes.ClassName"/>
    
    select col1 as {b.p1},col2 as {b.p2}
    from db_table_name tab where tab.nonExisting = xxxxx
    
    </sql-query>
    

    您班级中的 p1 和 p2 变量。表格中的 col1 和 col2 列。

    【讨论】:

      猜你喜欢
      • 2013-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-09
      • 1970-01-01
      • 2017-05-28
      • 1970-01-01
      • 2017-04-09
      相关资源
      最近更新 更多