title: spring-data subquery within a Specification
body: <p><a href="http://www.springsource.org/spring-data/jpa" rel="noreferrer">Spring-data</a>, Oliver Gierke's excellent library, has something called a <a href="http://static.springsource.org/spring-data/data-jpa/docs/current/api/org/springframework/data/jpa/domain/Specification.html" rel="noreferrer">Specification</a> (org.springframework.data.jpa.domain.Specification).  With it you can generate several predicates to narrow your criteria for searching.</p>
  
  <p>Can someone provide an example of using a Subquery from within a Specification?</p>
  
  <p>I have an object graph and the search criteria can get pretty hairy.  I would like to use a Specification to help with the narrowing of the search, but I need to use a Subquery to see if some of the sub-elements (within a collection) in the object graph meet the needs of my search.</p>
  
  <p>Thanks in advance.</p>