我有两个表User和Address table
而它们在HBM中的关系是
<!-- bi-directional one-to-one association to Address -->
<one-to-one
name="user"
class="address"
outer-join="auto"
/>因此,当我在用户Pojo中设置地址Pojo并为用户Pojo调用findByExample时。
它忽略地址Pojo
发布于 2012-01-31 16:01:03
忽略
版本属性、标识符和关联。
但它也说:
您甚至可以使用示例将条件放置在关联的对象上。
List results = session.createCriteria(Cat.class)
.add( Example.create(cat) )
.createCriteria("mate")
.add( Example.create( cat.getMate() ) )
.list();发布于 2012-01-31 16:02:52
关联将被忽略,如hibernate参考中所述:
http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querycriteria.html#querycriteria-examples
https://stackoverflow.com/questions/9076127
复制相似问题