Question: is there any way to get entity class in JPQL query

Hello, I'm using J*dev 11gR1 adn JPA with EclipceLink*.
Let's consider such example
@Entity
@Table(name="ANIMALS")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Animal implements Serializable {
@Entity
@Table(name = "CATS")
public class Cat extends Animal implements Serializable{
@Entity
@Table(name = "DOGS")
public class Dog extends Animal implements Serializable{
}I need to build a query which will be translated to something like this SQL query:
SELECT * FROM CATS
UNION ALL
SELECT * FROM DOGS
ORDER BY ...So I need a way to query not all child entities from DB.
P.S. Yes, I know, that I can execute query on panent entity (select a from Animal a order by ...) and then loop throught the result list and delete not needed objects OR I can execute some queries on needed child entities and then merge them into one list and sort it, BUT both ways it will be much slower than generetion of needed SQL query straight to DB.
I know, that in Hibernate's HQL there is a way to build such query with something like this:
select * from Animal a where a.class = Cat or a.class = Dog

In JPA 2.0 which we are implementing right now you will be able to execute queries like:
SELECT a FROM Animal a  WHERE TYPE(a) IN (Cat, Dog)The next draft of the specification contains a section which describes the feature in detail and provides more examples of its use:
4.6.17.4 Entity Type Expressions
An entity type expression can be used to restrict query polymorphism. The TYPE operator returns the
exact type of the argument.I have also been working with some customers on similar capabilities using the current versions of EclipseLink. The examples are documented here:
http://wiki.eclipse.org/EclipseLink/Development/JPA/QueryDownCast
I hope this helps,
Doug

Similar Messages

  • I forget my answer on security question is there any way to get it?please need ur help ..i try to resend to my mail but no mails coming

    thanks

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, and filling out and submitting this form.
    (96810)

  • I have a Macbook Pro june 2011... I have 8GB ram but I only have 256mb VRAM... I've read some other questions about this and I realized... Why do I not have 560mb of VRAM since I have 8GB of RAM? Is there any way to get more VRAM to play games on steam?

    I have a Macbook Pro june 2011... I have 8GB ram but I only have 256mb VRAM...
    I've read some other questions about this and I realized... Why do I not have 560mb of VRAM since I have 8GB of RAM?
    Is there any way to get more VRAM to play games on steam?
    I've learned  by reading other topics that I can't upgrade my graphics card on my Macbook Pro because it's soldered into the motherboard or somthing like that, but please tell me if there is any way to get more video ram by chaning some setting or upgrading something else. I'd also like to know why I only have 256MB of VRAM when I have 8GB of RAM, since I have 8GB of RAM I thought I was supposed to have 560mb of VRAM...
    So the two questions are...
    Is there any way to upgrade my VRAM, so that I can play games on steam?
    Why do I only have 256MB VRAM when I have 8GB total RAM?
    Other Info:
    I have a quad core i7 Processor.
    My graphcics card is the AMD Radeon HD 6490M.
    I am also trying to play games on my BOOTCAMPed side of my mac, or my Windows 7 Professional side.
    THANK YOU SO MUCH IF YOU CAN REPLY,
    Dylan

    The only two items that a user can change on a MBP are the RAM and HDD (Retinas not included).  You have what the unit came with and the only way you will be able to change that is to purchase a MBP with superior graphics
    If you are very much into gaming, the I suggest A PC.  They are far superior for that type of application to a MBP.
    Ciao.

  • I had 41 tabs open in about six groups over the last year and a half and I just close them and exited Firefox. Is there any way to get them back?

    <blockquote>Locking duplicate thread.<br>
    Please continue here: [[/questions/856718]]</blockquote>
    I had 41 tabs open in about six groups over the last year and a half and I just close them and exited Firefox. Is there any way to get them back?
    Also, is there any way to save a group or an open session and then restore it later?

    History menu, if it was destroyed in the last session
    then use "Restore Previous session:" and then restore all windows also from the history menu.
    If done in this session try the restore all windows under the history menu.

  • Is there any way to get iCloud sync (iPhone + 2 Macs) without wi-fi?

    We have two Macs (MacBook Pro, iMac) and one iPhone 4; OSs up-to-date (Lion, iOS5).  Our only routine access to the internet is via the mobile phone 3G network for the iPhone, and via a 3G USB stick/dongle for the Macs, also using the mobile phone network.  We do NOT have access to the internet via a local wi-fi link to a router (whether ADSL or cable).  This is in Melbourne, Australia, btw.
    Question: is there any way at all that we can get syncing of contacts and calendars for all three devices? - preferably automatic, ideally real-time whenever a device could see the internet.  With syncing set, there seem to be some random updates (and duplication) between devices, but it seems that normally syncing is enabled only when the device sees the internet via a local wi-fi link to a router, and that's what we don't have.  (We can't trundle the iMac to an internet cafe either!)
    Understood that a local sync would be possible via iTunes for one of the two computers and the iPhone, provided they could see each other wirelessly - but there's a second computer...
    E-mail no problem; we use IMAP.
    All suggestions gratefully received!

    Thanks for this quick response.
    I thought I had established by searching forums that iCloud sync routinely requires wi-fi.  I can see from Apple documentation that backup does; and that Documents and Data (in iOS) has a switch to permit/deny syncing using a cellular network.  What I have not found is a one-stop-shop on the Apple site that says which iCloud facilities are supposed to work with cellular/3G networks and which not.  Can you point us to such a list?
    Regarding our own problem: the missing link appears to be the download of new entries from the cloud to either of the Macs, the Mac being connected to the internet via 3G.  For example a new calendar appointment entered on the Mac duly appears on the iPhone; but a new appointment entered on the iPhone fails to appear on the Mac.  (If it is re-entered on the Mac, it gets duplicated on the iPhone.)  Checking the iCloud website show that a new iPhone appointment is getting as far as the cloud; but apparently no further. 
    I think you'll agree that this makes iCloud calendar syncing next to useless.
    This may not (as you imply) be caused by the use of the 3G connection.  However in the two households in our family we have one with wi-fi and essentially the same setup, except that the iPhone is a 3GS.  In the wi-fi setup, a new appointment entered on the iPhone calendar promptly shows up on a Mac.
    If the sync problem has nothing to do with the mode of internet connection, how might it be cured?

  • When closing multiple tabs, is there any way to get back the option of saving those tabs OR NOT for your next session, within the warning dialogue box itself?

    For brief period of time, not in FF4, there was the option whereby when I closed multiple tabs, a firefox dialogue box opened warning me that I'm about to close multiple tabs, '''AND ALSO''' asking me if wanted to save those tabs for my next session, or trash them.
    The primary issue IS NOT about saving tabs. The primary question here is about getting THE OPTION back to the CLOSING MULTIPLE TABS WARNING DIALOGUE.
    The use case here should be obvious. However, since it is clearly not obvious that different people work in a variety of ways, and neither of those methods of working is "wrong" or "right" I will elaborate: Some people, for whatever reason, it doesn't matter why, want to save all their tabs on some occasions, and on other occasions don't.
    This preference varies throughout the day. Therefore it is inefficient to constantly go to preferences and change whether or not I want firefox to open all my tabs from my last session. It is more LOGICAL to place an option in the multiple tab warning dialogue as well, for people whose preference constantly changes.
    This option was available for a time in most of the Firefox 3 versions. Is there any way to get back this option in Firefox 4?

    Firefox 4 saves the previous session automatically, so there is no need for asking if you want to save the current session.
    You can use "Firefox > History > Restore Previous Session" to get the previous session.<br />
    There is also a "Restore Previous Session" button on the default <b>about:home</b> Home page.
    You can set the warn prefs on the <b>about:config</b> page to <b>true</b> via the right-click context menu or toggle the value with a double left-click.
    * browser.showQuitWarning, see http://blog.zpao.com/post/3174360617/about-that-quit-dialog
    * browser.tabs.warnOnClose, see http://kb.mozillazine.org/About%3Aconfig_entries
    * browser.warnOnQuit , see http://kb.mozillazine.org/browser.warnOnQuit
    * browser.warnOnRestart , see http://kb.mozillazine.org/browser.warnOnRestart
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • The other day I had to reset my phone because i pulled it out from my laptop when it was updating. I then tried to restore it but i clicked the wrong option and it has restored all of my stuff from 2 years ago, is there any way to get back the stuff I had

    The other day I had to reset my phone because i pulled it out from my laptop when it was updating. I then tried to restore it but i clicked the wrong option and it has restored all of my stuff from 2 years ago, is there any way to get back the stuff I had

    maggielou wrote:
    I thought that I had backed up my pictures to icloud, but when I looked online at icloud, I don't see pictures listed.  However, a few of the recent pictures have shown up on my phone.
    IHow could I get these from my MacBook to my phone?
    Thanks again.
    When you log into you icloud account on your computer you are viewing data that you sync to icloud not the backups.  You can't view the backups.
    Look at the two links I provided.
    You still didn't answer any of my two questions I asked.

  • Uitableview grouped style-is there any way to get section background color

    hi all,
    So far i have tried myself and searched everywhere but didnt figured out that is there any way to get section background colors different for each sections in grouped style tableview.
    If anyone has tried something to get such thing would really be helpful to me.
    Thanks,
    C.P.

    Have you tried this? [http://stackoverflow.com/questions/813068/uitableview-change-section-header-co lor]

  • Is there any way to get volume level of  netStream?

    Hello,
    I want to get the activity level of audio of a NetStream, similar to how you can do it with a Microphone.
    In this article,
    http://stackoverflow.com/questions/1442913/as3-audio-activity-level-of-a-netstream
    NetStreamInfo.audioBytesPerSecond is said to be the solution.
    However, audioBytesPerSecond indicates how many data volume the stream have.
    It does not get volume level of the stream.
    It is not the same as microphone.activityLevel.
    Is there any way to get volume level of netStream?
    Thanks in advance.

    Thank you very much for your answer.
    I will use audioBytesPerSecond.
    I've tried SoundMixer class also, but it seems not working on streaming movies.

  • My old computer that ran on Mavericks was stolen and my new computer runs on Yosemite. I don't like the new iMovie (10) on the Yosemite version. Is there any way to get the old version (9) back?

    My old computer that ran on Mavericks was stolen and my new computer runs on Yosemite. I don't like the new iMovie (10) on the Yosemite version. Is there any way to get the old version (9) back?

    I read his question the way I answered it.
    If that is wrong then he can clarify his question.

  • I have a question is there any way I can put music from my iPad to my iPod? Some one said to me yes by using a DRM

    I have a question is there any way I can put music from my iPad to my iPod? Some one said to me yes by using a DRM

    Would those work if I am using the 4g wifi hotspot on the ipad to get the music onto an ipod touch?  I am willing to give up third party music if this would work. Just not sure if it would work since the 4g wifi has that 50mb restriction

  • I have an 06' macbook and I just bought an 07' macbook.. The 06' has os x 10.6 but the 07' has 10.5.. I no longer have the disk for snow leopard. Is there ANY way to get snow leopard from the old computer to the other without having to buy it again?

    I have an 06' macbook and I just bought an 07' macbook.. The 06' has os x 10.6 but the 07' has 10.5.. I no longer have the disk for snow leopard. Is there ANY way to get snow leopard from the old computer to the other without having to buy it again?

    Technical issues aside, there's still a legal issue.
    Neither 2006 nor 2007 MacBooks shipped with Snow Leopard 'factory' installed. OS X 10.6 Snow Leopard became available in September 2009. So you purchased and installed a Snow Leopard upgrade disc on the 2007 system at some point.
    If your Snow Leopard upgrade was a single-user copy, then legally, you need to purchase another one for the second computer. If your Snow Leopard upgrade was a Family Pack 5-user license, then you're good to go.
    http://store.apple.com/us/question/answers/product/MC574Z/A?pqid=QTUXD7AF4YU9FJD YUTDPCKYKUDDDXKHTK
    If you have an active MobileMe account, Apple was giving away a single-user upgrade copy of Snow Leopard for a limited time, and you should have received an email with a link, or been offered the opportunity when you signed in to your MobileMe account on the web:
    http://www.macrumors.com/2012/04/24/free-snow-leopard-discs-for-mobileme-users-n ow-arriving/
    Worst case, single-user Snow Leopard upgrade discs are $29 retail, direct from Apple. I'd hate to have two computers and no OS installation CD's for whatever version I'm currently using.

  • Is there any way to get my music back?

    i bought all of my music/videos from my ipod touch. it then got stolen and i have no music on my computer. however, my account does show my purchase history. my question is, is there any way to get the media content on my computer since i purchased it all?

    You do not need a serial number. Select "Music Purchases" then "Lost or Missing Items". You'll see an "Email Us" button which will take you to a form via which you can contact the iTunes Store.

  • HT5070 I purchased Season 2 of Game of Thrones and after watching episode 1 I realized I've already seen it.  I haven't downloaded any other episodes yet.  If there any way to get a refund?

    I purchased Season 2 of Game of Thrones and after watching episode 1 I realized I've already seen it.  I haven't downloaded any other episodes yet.  If there any way to get a refund?

    A refund may not be possible since the terms of sale for the iTunes Store state that all sales are final. You can contact the iTunes Store, explain the reason for your request, and ask, though:
    http://www.apple.com/support/itunes/contact.html
    It's possible they'll make an exception for you. Unlikely, but it doesn't hurt to ask.
    Good luck.
    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Communities page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums and in the Apple Knowledge Base, before you post a question.

  • Is there any way to get the height/width of an image before importing it in the indesign document.

    Hi All,
    I need to obtain an image's attributes such as dimensions (height, width in pixels) without placing image in indesign document.
    I have full path of the image (say abc.jpg is stored at c:\my pic\abc.jpg).
    I have obtained the IDFile for this image, tried getting size using GetFileSize() which correctly return size in bytes.
    Is there any way to get the height/width of image without importing it in the indesign document.
    Please, give me some hints. I have spent quite a lot time digging in CHM. I have searched in FileUtils, IDFile API's but found no method which serves this purpose.
    At this point I am clueless where to search next.
    Any help will be appriciated.
    Just a point to mention, I am able to get image height and width for an image in indesign doc though Its not my requirement.
    Thnx,
    D.

    You might be able to examine the contents of the PlaceGun after calling kImportAndLoadPlaceGunCmdBoss without actually placing the image in a document. Not sure, but would be worth looking at.
    Otherwise you will probably have to write platform specific code, ideally with a generic platform-independant wrapper (see SDKSamples/paneltreeview/PlatformFileSystemIterator).
    For the Mac, look at CGImageGetWidth() etc., not sure what the best option is for windows.
    Perhaps Quicktime could provide you with a platform independant solution.

Maybe you are looking for