[英]Fetch ManytoOne based on certain condition
I am using Hibernate 3.5.4
version as Orm I have two tables which have many to one relationship , Like Table 'Book' can have many 'Authors' associated with It. 我正在使用
Hibernate 3.5.4
版本作为Orm,我有两个具有多对一关系的表,就像表'Book'可以有许多与其关联的'Authors'。
@OneToMany(mappedBy = "key.bookId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
public Set<BookAuthor> getAuthors() {
return authors;
}
But we use soft delete for deleting the association (we maintain a column named isDeleted
) , i want to fetch the entity based on isDeleted
check if its 1 it should not be loaded , else if 0 load it. 但是我们使用软删除来删除关联(我们维护名为
isDeleted
的列),我想基于isDeleted
获取实体,检查是否应加载它的1,否则应加载0。
Is it possible by modifying this current fetching strategy to provide above support or there is another better solution that can be applied please let me know. 是否可以通过修改当前的获取策略来提供上述支持,或者可以应用其他更好的解决方案,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.