【发布时间】:2011-10-07 04:24:22
【问题描述】:
我使用单独的 hbm.xml 文件进行休眠映射,并在定义瞬态属性时遇到问题。我花了几个小时没有运气来搜索工作示例或编写自己的示例。
有人可以帮助我通过 hbm.xml (如果可能的话)使属性瞬态,因为它会使我的应用程序保持一致。如果通过 hbm.xml 无法实现,那么尽管使用 xml 进行了注释。
欢迎任何指向现有文档或主题的链接。
我的示例映射类是:
<class name="Test">
<id name="a" type="long">
<generator class="identity" />
</id>
<property name="b" type="string" />
<property name="c" type="string" />
</class>
示例实体类是:
public class Test {
private Long a;
private String b;
private String c;
public void setA(Long a) { this.a = a; }
public Long getA() { return a; }
public void setB(String b) { this.b = b; }
public String getB() { return b; }
public void setC(String c) { this.c = c; }
public String getC() { return c; }
}
【问题讨论】:
标签: hibernate