
select i from Item i
where type(i) IN (Book, Movie)
/* 실제 SQL
select i from i
where i.DTYPE in (‘B’, ‘M’)
*/
예) 부모인 Item과 자식은 Book이 있을 경우
select i from Item i
where treat(i as Book).author = ‘kim’
/* 실제 SQL
select i.* from Item i
where i.DTYPE = ‘B’ and i.author = ‘kim’
*/