I couldnt understand clearly from your post, Try the following code if your intent is to get Box and User object using HQL option.
Code:
String hql = "From Box b, User u where b.userid = u.userid";
Query q = session.createQuery( hql );
List results = q.list();
for ( int a = 0; a < results.size(); a++ ) {
Object[] data = ( Object[] ) results.get( a );
if ( data[ 0 ] instanceof Box ) {
Box boxObject = ( Box ) data[ 0 ];
// you can user object from box iff you have bi-directional
// relation enabled in mapping file
User userObject = boxObject.getUser();
} else if ( data[ 1 ] instanceof Box ) {
// this also gives you user object
User userObject = ( User ) data[ 1 ];
}
}