我有两个表用户和地址表
它们在 HBM 中的关系是
<!-- bi-directional one-to-one association to Address -->
<one-to-one
name="user"
class="address"
outer-join="auto"
/>
因此,当我在 User Pojo 中设置 Address Pojo 并为 User Pojo 调用 findByExample 时。
它忽略地址 Pojo
最佳答案
Version properties, identifiers and associations are ignored.
但它也说:
You can even use examples to place criteria upon associated objects.
List results = session.createCriteria(Cat.class)
.add( Example.create(cat) )
.createCriteria("mate")
.add( Example.create( cat.getMate() ) )
.list();
关于java - Hibernate findByexample 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9076127/