Hi,
yes, it is possible to select just the userid. You include the fields you want to return in the SELECT clause of the query:
SELECT u.userid FROM User u WHERE ...
It is also possible to compare the two userid fields:
SELECT ... FROM User u, User2 u2 WHERE u.userid = u2.userid
There is a better way in case the two User classes have a relationship. Suppose class User has a OneToOne relationship to class User2 (so it has a field called user2 of type User2). Then the following query could help:
SELECT ... FROM User u JOIN u.user2 u2 WHERE ...
I hope that helps.
Regards Michael
[Message sent by forum member 'mb124283' (mb124283)]
http://forums.java.net/jive/thread.jspa?messageID=280166