I have two tables in my Database, Tuser and TCompany,
where
Tuser : id | name | email
Tcompany : id | companyName | userId
where userId is foregn key of Tuser table.
I have written a query to get all users whose name start with a
Criteria criteria = ctx.getSession().createCriteria(Tuser.class);
criteria.add(Restrictions.like("name", "a%"));
List res = criteria.list()
Now i need to get all users who do not belong to a company.
In sql, we can use sub-queries, but i am getting stuck as to how it is done using criteria?