User and Admin objects will have properties other than username and phone.
Typically Hibernate would cat queries that fetch only a sub-set of the properties of 1 or more tables as an Object[].
You can instead do this:
Code:
Query query= session.createQuery("select a from com.bosch.Admin a, com.bosch.User u where u.no=a.adminid");
This list will just be only "Admin" objects. However if you need both User and Admin objects, you will have to define the correct mapping between user and admin objects and then either fetch parent object.
So for e.g., if Admin has a one-to-many (bidirectional) relationship with User, then define that mapping and use the following HQL:
Code:
Query query= session.createQuery("from com.bosch.Admin");
However if your Admin is a sub-class of User etc. then you will have to map the object using one of the inheritance strategies provided by Hibernate.
Please provide the HBM mapping files to provide additional thoughts