开发者

Are Hibernate filters only applied after the data has been loaded from db?

开发者 https://www.devze.com 2023-01-13 02:37 出处:网络
I\'ve found some contradicting information on the net. Does anyone know whether Hib开发者_开发技巧ernate filters affect the generated sql, or is it just filtering the data as it\'s read from the datab

I've found some contradicting information on the net. Does anyone know whether Hib开发者_开发技巧ernate filters affect the generated sql, or is it just filtering the data as it's read from the database?


Hibernate filters affect the where clause of the generated SQL.

The Introduction to Hibernate Filters is a nice article on filters and provides a demo application allowing to play with them.


If you enable SQL in Hibernate using show_sql"(+"format_sql"), and execute query with enabled filter, you will see the result.

For example:

select
    item0_.ID as ID0_     
from
    ITEMS item0_ 
where
    item0_.deleted = 'FALSE' <-- here is filtering
0

精彩评论

暂无评论...
验证码 换一张
取 消