Q: How to fetch data from multiples tables in Hibernate? i am new to hibernate and want to know a few things. I want to implement the following query in hibernate,please guide me.
SELECT p.num_is_active
FROM ins.cnfgtr_user_log t, ins.service_user_auth p
WHERE t.source = 'GC'
and t.tokenid = p.txt_auth_token
and t.sessionid = 100000000195756
and t.userid = p.txt_user_id
and t.userid = 'MASTERADMIN'

I also want to know do i have to maintain two separate pojo's for these two tables? does this pojo's need to be complete? i mean do they need to contain all the columns of the tables or can they contain only the ones needed for this query?

A: Q: do i have to maintain two separate POJO's for these two tables?
Answer:  Yes you suppose to. Here in ORM each table will be represented by separate POJOs for modularity reasons.
Q: does this POJO's need to be complete?
Answer: Need not be. Except the columns marked as "not null". You can use JPA/Hibernate Joins for querying purpose. 
Hope this is helpful!
