-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to use View instead of Union?
PostPosted: Fri Mar 13, 2009 3:21 pm 
Newbie

Joined: Fri Mar 13, 2009 3:09 pm
Posts: 1
Hi,

First of all, thank you so much for your excellent work.

From FAQ, I understand Hibernate does not support Union.
After searching through Internet, I found several people recommending to use View as an alternative to Union.
Could somebody tell me how to do this?

For example, let's say I want to get distinct list of IDs from two tables.

I can use CREATE VIEW to extract ID lists from the two tables.

CREATE VIEW viewA AS
SELECT ID FROM TABLE_A

CREATE VIEW viewB AS
SELECT ID FROM TABLE_B

But I still end up with two views. I can't combine them using Union.

I also tried inserting viewA into viewB. This didn't work for MS SQL Server because it doesn't seem to allow insert into View. This option seems to have a compatibility issue among different databases.

So what is the best way of using View as an alternative to Union?

Any advice shall be appreciated.

Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.