These links should help:
Stack Overflow: http://stackoverflow.com/questions/3738555/hibernate-criteria-subquery
Hibernate Documentation: http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch17.html#querycriteria-detachedqueries
It actually depends how you have mapped the entities but it should look something like this (I haven't tried it):
Code:
DetachedCriteria subquery = DetachedCriteria.forClass( Node.class )
.add( Restrictions.eq( "bookId", ":bookId" ) )
.add( Restrictions.eq( "nodeType", "Test_NODE" ) )
.setProjection( Property.forName( "nodeId" ) );
DetachedCriteria.forClass( Post.class, "p" )
.createCriteria( "p.node", "n", JoinType.LEFT_OUTER_JOIN )
.add( Restrictions.ne( "p.status", "DELETED" ) )
.add( Restrictions.ne( "p.nodeId", "n.nodeId" ) )
.add( Subqueries.in( "p.nodeId", subquery ) );