Hi all,
I have a native SQL query written for SQL Server 2005.
The logic i want to get is :-
Quote:
i have 3 tables Account, Mailbox, Account_Mailbox. Every account has associated Mailboxes. I want to fetch those mailboxes that are excluding from the given account. I have an account_adminstrator_id (Every Account is created by an admin).
The native SQL for it is as below:-
Code:
<sql-query>
SELECT *
FROM mailbox
WHERE mailbox.administrator_account_id=?
AND mailbox.mailbox_id NOT IN (
SELECT mailbox.mailbox_id
FROM account, account_mailbox, mailbox
WHERE account.address=?
AND account.account_id=account_mailbox.account_id
AND account_mailbox.mailbox_id = mailbox.mailbox_id
AND mailbox.administrator_account_id=?)
</sql-query>
when i execute this query i am getting the resultset of objects, but i want to
retrun Mailbox object.
how can i change the sql query to query and to retrieve Mailbox Object. I am very much new to Hibernate.
My Hibernate Version is 3.1
DB SQLServer 2005
Thanks in advance
saikiran