Sql query with subQuery to hibernat criteria

I need help with converting sql query with subQuery to hibernat criteria. The sql query is:

select * from project_table where project_id in (select project_id from user_projects where user_id = '5') 

I tried like this and it didn’t work:

DetachedCriteria projectUser = DetachedCriteria.forClass(UserProjects.class)             .setProjection(Projections.property("project_id"))             .add(Restrictions.eq("project_id", id));     return session.createCriteria(Project.class)                 .add( Subqueries.propertyIn("my_project_id", projectUser) )                 .list();