简体   繁体   中英

Conditional Join in Hibernate

Here is what I am doing: Their is table MEDIA against this their are multiple entries in MEDIA_TAGS table. So based on some user input for media tags I have to fetch the MEDIA table records. So here I have to join the tables MEDIA and MEDIA_TAGS only when their is input for the media tags.

Since it is legacy system I cant modify the existing mapping in hbm file. I wanted to know if their is any functionality in Hibernate to add the join on some another table based on certain condition or dynamic input.

Does this possible with predefined filters or is their any way to achieve this in hibernate mapping. Any pointers on this greatly help me.

我使用了休眠标准.createAlias(..解决了这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM