How do I reducing the amount of joining when using one-to-one mappings?

Examine the following example;
class Person
Address address;
String firstName, lastName;
class Address
Long addressId;
String state, city, zip;
Assume that both of these classes are mapped to tables in a database. Attributes such as Staff's name and Address's addressId, state, city, and zip are direct-to-field mappings. Staff's address attribute is a one-to-one mapping.
If you write the following expression:
Expression exp = new ExpressionBuilder(Person.class).get("address").get("addressId").equal(4L);
Toplink will create a query like the following:
select first_name, last_name, address_id, ...
from person t0, address t1
where t0.address_id = t1.address_id
and t1.address_id = 4;
This is an unneccesary join because the person table already has the column with the data in it since it has a foriegn key. Is there someway to tell toplink to not join the tables when the only thing you are querying on is if a foriegn key that already exists in the referenced table? What I would want/expect to see is the following:
select first_name, last_name, address_id, ...
from person t0
where t0.address_id = 4;
I beleive we are using TopLink version 10.1.3.1

In your initial query you're actually saying "find the Person who has an Address who's id is 4". Your second query is "find the Person who references an address who's id is 4". The first query requires there be an Address with ID 4, the other does not.
If you define a query key "addressId" for the ADDRESS_ID column on the Person descriptor you can write this query as:
Expression exp = new ExpressionBuilder(Person.class).get("addressId").equal(4L);This will result in the SQL you want.
--Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • TS1503 How can I reduce the amount of 'other' space used up on an iPhone 5?

    I am almost at storage capacity on my iPhone 5.  Almost 1/3 of my 16GB is taken up by the category 'Other'.  I have read posts pertaining to this with solutions that are supposed to help by deleting all of my music.  But I have also been advised not to try that.  Any other suggestions or comments?

    If you have read the countless posts answering this question, then you n=know that you need to restore the iphone.  You can try from backup first.  If that does not help, then restore as new.

  • HT201774 How do I reduce the amount of email being sent to my iPhone 5 with iOS 7.0?

    How do I reduce the amount of email being sent to my iPhone 5 with iOS 7.0

    As I delete email more mail populates on the phone.

  • How can I reduce the amount of space between paragraphs in Pages?

    How can I reduce the amount of space between paragraphs in Pages?

    Let's pretend that you told us which version of Pages you are talking about, and that you are using Pages 5:
    click in the text > Format > Spacing > click on triangle to expand options > change Before/After
    Peter

  • How do you reduce the amount of mb used by other i dont know what this is?

    how do i reduce the amount of mb used by other on my itunes do i can record more videos?

    http://osxdaily.com/2013/07/24/remove-other-data-storage-iphone-ipad/

  • When I look in Add/Remove Programs in the Control Panel it reports Firefox as 5.44GB. Could this be true? If so how do I reduce the amount of space it is taking up?

    When I look in Add/Remove Programs in the Control Panel it reports Firefox as 5.44GB. Could this be true? If so how do I reduce the amount of space it is taking up?

    It is quite common for the program size listings to be wrong. To check the actual size of the Firefox installation, you can manually check the size of the Firefox [http://kb.mozillazine.org/Installation_directory installation directory]. It is is typically around 26-30Mb, and the default location on 32 bit Windows is C:\Program Files\Mozilla Firefox\
    There are also a couple of other locations where Firefox stores data, check the size of the following folders as well.
    Firefox also stores user data such as bookmarks and passwords in the [[profiles|profile folder]]. It should be inside this folder C:\Users\''username''\AppData\Roaming\Mozilla\Firefox\Profiles\
    Firefox stores temporary files in the cache. To find the location of the cache, type '''about:cache''' into the location bar. It should be inside this folder C:\Users\''username''\AppData\Local\Mozilla\Firefox\Profiles\
    The last 2 folders are normally hidden, you may need to set Vista to [http://www.bleepingcomputer.com/tutorials/tutorial130.html show hidden files and folders].

  • How can I reduce the amount of storage my iPhone uses for messages?

    Is there any way to reduce the amount of storage space my iPhone uses for Messages?  Can I limit the storage to the last year or some other limit (specific date, specific amount of storage etc.)?
    Thank you

    I'm not sure there is a solution to your question, other than to not keep so many photos on your devices.  If you delete a photo from photo stream, it will delete it from all your devices.  To keep them, first save them to your camera roll (tap Edit, tap the photos, tap Share, tap Save to Camera Roll), then import them to your computer as explained here: http://support.apple.com/kb/HT4083.  However, given the number of photos you have, a much more practical solution would be to transfer them to your computer using an app like PhotoSync, which will select them all at once and transfer them over wifi.
    I'm not sure why you're seeing such a discrepancy in the amount of space taken up by your photos.  It's possible that something is corrupt given the large number of photos on your device.

  • How do I reduce the size of photos to use on website?

    Thanks to the helpful person who recommended I use Rapidweaver to build a website, I am slowly getting somewhere. It is so simple and just like Apple applications that I think I can do this.
    My problem now is that when I tried to transfer a photo from iPhoto to the draft website page it comes across so large it fills the page.
    How do I reduce the size of photos so that I can bring them across? I need to show about 20 photos on the web pages. Do they need to be in a different format and if so how do I change it to the appropriate one?
    Many thanks.
    ibook   Mac OS X (10.3.9)  

    Hi Casuarina,
    Go to this site and click on the Desktop Version Quicktime movie for a small tutorial. It will explain everything to you and you can see how you resize right within Rapid Weaver. It's really quite nifty.
    http://donmc.libsyn.com/index.php?post_id=37133
    Lori

  • How do I reduce the amount of space that "Other" takes up on my macbook pro.

    I've just bought a new macbook pro with Retina display & running Yosemite. I have the 128Gb version.
    Initially I downloaded all my music into iTunes, but after seeing that it took up almost 40Gb of the 128Gb I decided to delete it from the Macbook. But now I find that I have 40Gb of "Other" in it's place. Does anyone know what "Other" is and how I can reduce it's bulk? (Image attached)

    About “Other”:
    http://support.apple.com/en-us/HT202867
    Go step by step and test.
    1. Start up in Safe Mode.
        http://support.apple.com/kb/PH11212
    2. Empty Trash.
       http://support.apple.com/kb/PH13806
    3. Disk space / Time Machine ?/ Local Snapshots
      Local backups
       http://support.apple.com/kb/ht4878
    4. Delete old iOS Devices Backup.
        iTunes > Preferences > Devices
        Highlight the old Backups , press “Delete Backup” and then “OK”.
        http://support.apple.com/kb/HT4946?viewlocale=en_US&locale=en_US
    5. Re-index Macintosh HD.
        This will take a while. Wait until it is finished.
        System Preferences > Spotlight > Privacy
        http://support.apple.com/kb/ht2409
    6.Try OmniDiskSweeper. This will give the storage size details of the items.
       https://www.omnigroup.com/more
       Select Macintosh HD and click  “Sweep Selected Drive” at the bottom.
       Delete the files you don’t want to keep.
       Be careful. Delete only the files that can be safely  deleted.

  • How can I reduce the amount of user prompts for Email setup in Apple Configurator?

    I am working on deploying profiles via Apple's new Apple Configurator which allows me to install apps and settings exactly how I want them. My question pertains to the email setup where anything left blank in the payload gets prompted on the device for user input. Is there anyway to have the user only enter in their user name and password once and use that for the SMTP outgoing settings as well? I'd like to reduce the user interaction to a minimal.Currently they enter in their full name, email address, user name for incoming, password for incoming, and then user name AGAIN for outgoing (I checked the box for 'Outgoing password same as incoming'). Is there anyway to retain the username and avoid having the user enter it in twice?
    If not, I can make do with how it is, but was rather curious if this is possible. Any help would be greatly appreciated.

    I'll try this again starting it as new, but when I restored it before (after deleting all the apps and music off it) it didn't help.  Thanks for the suggestion!

  • How do i reduce the amount of space used by 'other on the iPhone

    I have 2.28 GB 'other' used space on my iphone 4S 16GB running IOS 6.02 latest IOS and synced with IMAC using the latest OSX 10.8.2 and latest Itunes.
    How do i reduce this. what is the 2.28 made up of?
    If the space is old emails, texts, address book contacts as a cursory google search seems to suggest how to i reduce each component part?
    Any suggestions / advice appreciated.

    Knowmadiq wrote:
    I have 2.28 GB 'other' used space on my iphone 4S 16GB ...
    See this Discussion...
    https://discussions.apple.com/message/21053176#21053176

  • How can I reduce the amount of storage a shared photo stream is taking on one of my devices

    I have over 8000 photos on the Cloud in various shared photostreams.  They all appear on all my devices which is great.  The devices show the photos using about 1GB of memory unless I plug into iTunes when it reveals they are in fact using circa 15GB!!  This is ok on the devices with large memory capacity but one of my 'phones is only 16GB in total and is now full.
    If I try to delete a photostream on this phone it threatens to delete the photostream on all my devices.
    It would appear that my cloud storage for photostream is limited by the device with the least memory. 
    Any ideas on solutions gratefully received.  Buy a new phone with more memory or delete some of the photostreams are the sub optimal ideas I have at present.
    Also why is the usage understated on the devices and only revealed when I plug in to iTunes?
    Many Thanks
    D

    I'm not sure there is a solution to your question, other than to not keep so many photos on your devices.  If you delete a photo from photo stream, it will delete it from all your devices.  To keep them, first save them to your camera roll (tap Edit, tap the photos, tap Share, tap Save to Camera Roll), then import them to your computer as explained here: http://support.apple.com/kb/HT4083.  However, given the number of photos you have, a much more practical solution would be to transfer them to your computer using an app like PhotoSync, which will select them all at once and transfer them over wifi.
    I'm not sure why you're seeing such a discrepancy in the amount of space taken up by your photos.  It's possible that something is corrupt given the large number of photos on your device.

  • How do I reduce the amount of Gbs that my music takes up

    I have roughly 2400 songs and it's taking 16 Gbs which I cannot load onto my iPhone any way I can reduce the file size without re-importing the songs?

    There is also the option to convert files as they are copied to the device to make them take up less room, which leaves you the better quality originals in your library.
    tt2

  • How can I disenable the EXCEL field format when use ALV download to excel ?

    Dear friends,
         I have a problem with the ALV download to EXCEL. One field Value in ALV is like u2018-abcdeu2026u2019.the character u201C-u201Cis the first   position  in field value.when I download  the value to EXCEL,the field value u2018-abcdeu2026u2019 changed u2018=-abcdeu2026u2019 in EXCEL.how can I remove u2018=u2019 in EXCEL when I down to excel used ALV.
    I add a space in u2018  -abcdeu2026u2019,So this value can be download to Excel .
    Have you any solve method?
    User does not use excel logo button to download.
    User use Local fileu2026 button to download
    Thanks
    Sun

    add a single quote to the beginning of the field.
    like:  '-abcde
    in excel it will be shown as : -abcde

  • Is there a genuine IPad anti glare screen to reduce the reflection/mirror effect when using outdoors?

    The reflection in the IPad 4th generation retina screen when using outdoors or in bright light is very distracting. You look at yourself! Especially if using the pad on your knees.
    I have fitted the excellent Moshi clear protection screen, but this does not reduce the reflection. Amazon sell an anti glare screen for the IPad 2. Anyone found one that really works, or is this something we must put up with.

    Linehill again.  It seems that many users find the same problem, but no one has the answer! I have been experimenting with some ideas and have found wearing a black or very dark shirt makes a huge improvement if you are sitting down and hold the IPad on your thighs. Try it!

Maybe you are looking for

  • Cisco VPN Client is not opening on windows 7 64bits

    Hello, My problem : i instaled Cisco VPN client 5.0.07.0440-k9 on Windows 7  64 bits, the installation ends successfully. But when i restard the computer, when i click it doesnt open. Notice : when i restard the computer, it takes an infinite time th

  • SQLJ error in stored procedure

    Okay I'm kind of new to this stuff so this is probably an easy question but I can't fix my current problem. Know I have been creating and compiling several java stored procedures in my oracle 8.1.7.0.0 enterprise edition database. So far everything i

  • HT204382 i need help guys mi karaoke videos aren't playing anymore how can i download some drivers for it ?

    i need help guys mi karaoke videos aren't playing anymore how can i download some drivers for it ?

  • Network settings not sticking?

    Noob (Win convert) question, I think. Leopard 10.5 with DHCP enabled on my home and work networks. All settings from the DHCP servers come across and are correct in the Network prefernces. But, when I open the Network preferences panel and select Adv

  • MOSS MA not found

    Hi, when i try to create profile synchronization connection on ok im getting MOSS MA not found error. i have check both forefront services are running , i have restarted them using services.mnc. i have also stop and start user profile service and syb