Three way join mapping

I have three tables file, file_location, and file_object as bellow:
file_location (file_id, file_system_id, stored_on,...)
file (file_id, name, object_id, file_size, ...)
file_object (object_id, created_on, ...)
I need to issue a query that do three way join, for example
SELECT floc.stored_on, mf.file_size, mo.created_on
FROM file_location floc, file mf, file_object mo
WHERE mf.file_id = floc.file_id
AND mo.object_id = mf.object_id
AND floc.file_system_id = 1
How can I avoid doing a separate query for each File and each FileObject(without writing custom SQL to produce some new view-object)?
I would expect the tool to be able to do this in three queries, one for each table, which are then linked up on the client side.
Does anybody know how to do this? I tried different approach including use join, but always end up with separated queries for each object.
Thanks

I'm am not clear on your object model, or the relations between File, FileObject and FileLocation, but in general to optimize queries in TopLink you can use batch reading, joining, partial object reading or report queries.
If you just want the three data values back, one from each object, you might be best off using a ReportQuery.
i.e.
ExpressionBuilder file = new ExpressionBuilder();
ReportQuery query = new ReportQuery(File.class, file);
query.addAttribute("fileSize");
query.addAttribute("storedOn", file.get("location").get("storedOn"));
query.addAttribute("createdOn", file.get("fileObject").get("createdOn"));
List result = (List) session.executeQuery(query);
To read the objects, assuming File has a 1-1 to FileObject and 1-1 to FileLocation, you could query for File and batch read FileObject and FileLocation.
i.e.
ReadAllQuery query = new ReadAllQuery(File.class);
query.addBatchReadAttribute("fileObject");
query.addBatchReadAttribute("fileLocation");
List result = (List) session.executeQuery(query);
If your are trying joining/batch reading and still getting separate calls please include your query definition. It could be that you have already read and cached these objects with value holders in them, or are not using indirection in general.

Similar Messages

  • Opinion needed on best way to map multiple table joins (of the same table)

    Hi all
    I have a query of the format:
    select A.col1, B.col1,C.col1
    FROM
    MASTER_TABLE A, ATTRIBUTE_TABLE B, ATTRIBUTE_TABLE C
    WHERE
    A.key1 = B.key1 (+)
    AND
    A.key1 = C.key1(+)
    AND
    B.key2(+) = 100001
    AND
    C.key2(+) = 100002
    As you can see, I am joining the master table to the attribute table MANY times over, (over 30 attributes in my actual query) and I am struggling to find the best way to map this efficiently as the comparison for script vs. mapping is 1:10 in execution time.
    I would appreciate the opinion of experienced OWB users as to how they would tackle this in a mapping and to see if they use the same approach as I have done.
    Many thanks
    Adi

    SELECT external_reference, b.attribute_value AS req_date,
    c.attribute_value AS network, d.attribute_value AS spid,
    e.attribute_value AS username, f.attribute_value AS ctype,
    g.attribute_value AS airtimecredit, h.attribute_value AS simnum,
    i.attribute_value AS lrcredit, j.attribute_value AS airlimitbar,
    k.attribute_value AS simtype, l.attribute_value AS vt,
    m.attribute_value AS gt, n.attribute_value AS dt,
    o.attribute_value AS datanum, p.attribute_value AS srtype,
    q.attribute_value AS faxnum,
    R.ATTRIBUTE_VALUE AS FAXSRTYPE,
    s.attribute_value AS extno,
    t.attribute_value AS tb, u.attribute_value AS gb
    v.attribute_value AS mb, w.attribute_value AS stolenbar,
    x.attribute_value AS hcredit, y.attribute_value AS adminbar,
    z.attribute_value AS portdate
    FROM csi_item_instances a,
    csi_iea_values b,
    csi_iea_values c,
    csi_iea_values d,
    csi_iea_values e,
    csi_iea_values f,
    csi_iea_values g,
    csi_iea_values h,
    csi_iea_values i,
    csi_iea_values j,
    csi_iea_values k,
    csi_iea_values l,
    csi_iea_values m,
    csi_iea_values n,
    csi_iea_values o,
    csi_iea_values p,
    csi_iea_values q,
    CSI_IEA_VALUES R,
    csi_iea_values s,
    csi_iea_values t,
    csi_iea_values u,
    csi_iea_values v,
    csi_iea_values w,
    csi_iea_values x,
    csi_iea_values y,
    csi_iea_values z
    WHERE a.instance_id = b.instance_id(+)
    AND a.instance_id = c.instance_id(+)
    AND a.instance_id = d.instance_id(+)
    AND a.instance_id = e.instance_id(+)
    AND a.instance_id = f.instance_id(+)
    AND A.INSTANCE_ID = G.INSTANCE_ID(+)
    AND a.instance_id = h.instance_id(+)
    AND a.instance_id = i.instance_id(+)
    AND a.instance_id = j.instance_id(+)
    AND a.instance_id = k.instance_id(+)
    AND a.instance_id = l.instance_id(+)
    AND a.instance_id = m.instance_id(+)
    AND a.instance_id = n.instance_id(+)
    AND a.instance_id = o.instance_id(+)
    AND a.instance_id = p.instance_id(+)
    AND a.instance_id = q.instance_id(+)
    AND A.INSTANCE_ID = R.INSTANCE_ID(+)
    AND a.instance_id = s.instance_id(+)
    AND a.instance_id = t.instance_id(+)
    AND a.instance_id = u.instance_id(+)
    AND a.instance_id = v.instance_id(+)
    AND a.instance_id = w.instance_id(+)
    AND a.instance_id = x.instance_id(+)
    AND a.instance_id = y.instance_id(+)
    AND a.instance_id = z.instance_id(+)
    AND b.attribute_id(+) = 10000
    AND c.attribute_id(+) = 10214
    AND d.attribute_id(+) = 10132
    AND e.attribute_id(+) = 10148
    AND f.attribute_id(+) = 10019
    AND g.attribute_id(+) = 10010
    AND h.attribute_id(+) = 10129
    AND i.attribute_id(+) = 10198
    AND j.attribute_id(+) = 10009
    AND k.attribute_id(+) = 10267
    AND l.attribute_id(+) = 10171
    AND m.attribute_id(+) = 10184
    AND n.attribute_id(+) = 10060
    AND o.attribute_id(+) = 10027
    AND p.attribute_id(+) = 10049
    AND q.attribute_id(+) = 10066
    AND R.ATTRIBUTE_ID(+) = 10068
    AND s.attribute_id(+) = 10065
    AND t.attribute_id(+) = 10141
    AND u.attribute_id(+) = 10072
    AND v.attribute_id(+) = 10207
    AND w.attribute_id(+) = 10135
    AND x.attribute_id(+) = 10107
    AND y.attribute_id(+) = 10008
    AND z.attribute_id(+) = 10103
    AND external_reference ='07920490103'
    If I run this it takes less than a second in TOAD, when mapped in OWB it takes ages. 10:1 is a conservative estimate. In reality it takes 15-20 minutes. CSI_IEA_VALUES has 30 million rows CSI_ITEM_INSTANCES has 500,000 rows.
    Hope that helps. I would love to know how others would tackle this query.

  • Doubt on Join Mapping documentation

    Dear all,
    Let me present the following case: I'm working against an Oracle database where I have two tables ASSET (id NUMBER, name VARCHAR2, asset_type_id NUMBER) and ASSET_TYPE (id NUMBER, type_name VARCHAR2).
    What I want to try is to build an Asset.cfc with the id (numeric), name (string), and typeName (string) properties. I tried to avoid having an AssetType class loaded into the type property that later I had to access with asset.getType().getTypeName(), but having the typeName string directly as asset.getTypeName().
    Then I read the "Join mapping in a CFC" section of the CF9 documentation and thought to have found an elegant solution. The document presents the Employee-Address relationship and uses the addressId joincolumn, but never explains if the addressId column is member of the Employee or the Address table. I guessed the addressId was a column of the Employee table pointing to the PK of the Address table, and tried to apply that logic to my case; of course, it does not work. Then I reached the conclusion that the addressId must be a member of Address table that maps automatically always to the PK of the Employee table.
    (1) Is my conclusion right? I.e. is the joincolumn a member of the target table and joins always automatically to the defined PK of the source table? If this is the case, I cannot solve my problem this way as I want to join the target id column with the source asset_type_id column.
    (2) Is there a way to override this and make the joincolumn to join to an alternative source column other than the PK?
    (3) Does anyone knows the why of this limitation?
    (4) Could anyone explain an alternative way for getting the type string directly with asset.getType() without creating an explicit AssetType cfc? Is there some pattern or best practice for this case?
    Sorry for the long post and thanks in advance for your help.
    Regards,
    Jesús

    Ok,
    A solution seems to be the @formula parameter (sorry I didn't find the http://forums.adobe.com/message/2298153#2298153 post before). Any solution using the join mapping? (I guess not). Any other ideas?
    Just one question for the experts: if I use the formula for several properties calculated from the same table, does hibernate intelligently translate them to a single query?
    Thanks,
    Jesús

  • I split my clip in three ways, then deleted the middle clip

    I have a question. I split my clip in three ways, then deleted the middle clip, what I do to join these three clips again ? I need some help. Is It only work with the Precision Editor? because i think it s so difficult!

    Not sure I understand.
    What do you mean by
    when I cut back on the corner of a clip that connects to another,
    If you do what I suggested above you should be able to bring back the original clip to the project from the event without affecting the other clips in the project ( ie without damaging the rest of the other cuts?)
    You can drag the original clip (or any clip) to any position in the ' Time-line"
    I assume from your post that you are using iMovie 11???

  • HTC ThunderBolt Three-Way Calling

    Hi everyone. I've searched the forum but haven't found a topic that discusses this problem I have. When I'm using three way calling feature  on the Thunderbolt and want to disconnect just one call and continue with the other, the device drops both calls instead of just one. I checked the user manual and it says that I just need to select the call that I want to end press end call. For some reason both calls end. Has anyone else experienced this problem? 

    Hi everyone!
    There is much confusion on whether this is by design or a flaw and whatnot. And some of the confusion may be mine. 
    Let me say first, my post on another thread that has been copy/pasted here was about call waiting only. It had nothing to do with a three-way conference call. The call waiting feature is designed to have both calls end and the original call rings back in five seconds later. The original caller in that scenario doesn't know it's ringing back to you, they're still on-hold and when you answer the call-back, they are re-joining you.
    Now, in this thread about three-way calling, I believe what we are trying to correct (and establish something is wrong) is the 'private call' feature that allows you to basically end the 3-way call and go back to a two-way call with the first participant. And that function is not working properly, resulting in both calls ending.  I have a Thunderbolt and have never used the three-way conference call feature. And you can imagine the amount of people making use of this feature is far smaller than those making two-way calls. I only say that because internally we have nothing posted about this issue, making it hard to fix in any amount of software updates. I have tested three-way calling with two different thunderbolts and I have the same results. No 'Private Call' option.
    So, I will take this information and escalate to our product team for further investigation in hopes we can correct it in a future update!
    Please politely advise here if I'm way off base or not.
    Thank you so much!

  • How do I get a three-way colour blend (and rounded edge effect)?

    For what it's worth I'm using Illustrator CS5 but I imagine any solution will apply to all recent versions.
    In practice I've pretty much got where I need to so this isn't an immediate problem, but I'm sure there are much better ways of achieving the effect and I'd like to have them in stock for future reference. I'm not sure if this is a basic matter that I should be able to figure out easily or a challenge for more advanced practitioners; either way, I'd be grateful for any suggestions.
    The end product I was after - sort of - is shown here:
    The two elements I struggled with were:
    Blending the colours where they join - particularly the three-way blend at the middle, which in the end I avoided by placing another object on top! I resorted to a manual, tedious and inaccurate point-by-point approach using meshes and it didn't really deliver what I wanted, which was a seamless join between the colours.
    Getting the effect of a rounded edge at the perimeter of the triangle - I used the same mesh-and-guesswork technique (and it shows).
    In whatever solution anyone can suggest, one of the important things is to be able to dictate the distance over which the blend and shading operate, both where the colours merge and at the rounded edges. Feel free, by the way, to start from the very beginning with "First, construct your triangle" - I realised, as I did this, that there are a many different ways to do that, and one may be better than another for a particular blending approach.
    Thanks for your thoughts,
    Giles.

    1. Polygon Tool: ShiftDrag to draw a triangle oriented with one of its corners at the top.
    2. Apply a linear grad fill, blue to white, -90°
    3. Appearance palette: Add New Fill. Linear grad, red to white, 30°
    4. Appearance palette: Add New Fill. Linear grad, green to white, 150°
    5 Appearance palette: Select each fill. Set its Transparency Mode to Exclusion.
    6.Deselect. Select the path. Effect>Distort>RoundedCorners.
    JET

  • Quantity variance in Invoice Vs. Three way match in PO

    Hi Experts,
    I am not able to find any differrence between quantity variance Vs. Three way match in PO.
    For example in our purchase orders for all the items we are having Two way match (PO-Inv, GR-Bsd Inv is not checked) but we have defined quantity varaince in Invoice. So when we are trying to post invoice for purchase order item for which goods reciept is not performed, system is blocking the invoice due to quantity variance.
    So i think if you have quantity variance at invoice level then system is going to check whether goods reciept is perfromed or not regardless of Two way or three way match.
    Please advise if my understanding above is correct.
    My second question is as we can define two way/three way match at various level (Supplier, Inforecord etc.). Is there anyway that i can define that quantity variance in Invoice should be for certain material groups only.
    Please advise.
    Regards,
    Kamal

    hi,
    when you set the qty variance, and try to post the invoice just after the PO, the system will show a message at IR ie. " Quantity delivered is Zero"...
    this message is warning message...
    The system will block the invoice item when the doc is posted, depending on how the tolerance key DW  is set(Qty variance to Gr qty = zero)...
    Hope it helps..
    Regards
    Priyanka.P

  • Three way matches

    I need to check configuration setting to check if three way matches have been activated for
    1) Vendor Order, Good Receipt and Payment to Vendor
    2) Customer Order, Customer Invoice and Customer Payment
    How do I do check this, what is the path.

    Hi
    For vendors check ME23n---Display PO
    MIGO-- Goods receipt
    MIRO--Invoice reciept
    Regards
    Aravind

  • Three-way mirror disk requirement

    In Windows 2012 Storage Space, why 3-way mirror requires minimum 5 disks instead of 3? How does 3 way mirror works? I tried to find the tech paper on MS website but either I didn't try hard enough or the info is not there.

    Hi,
    The reason is that a 3-way mirror uses a quorum.  In order to keep running, the mirror space must keep over 50% of the disks functioning.  So a 3-way mirror must have at least 5 physical disks to be able to survive the loss of up to 2 physical disks.
    For more detailed information, please refer to the links belwo:
    Tip Of the Day: 3-way Mirrors
    http://blogs.technet.com/b/tip_of_the_day/archive/2013/08/29/tip-of-the-day-3-way-mirrors.aspx
    mirror in storage pool
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/2e6955b7-b293-4880-8fb3-8b4ce0e02ec9/mirror-in-storage-pool?forum=winserver8gen
    You could also refer to the article below to know more about three-way mirror:
    Windows Server 2012 SMB 3.0 File Shares: An Overview
    http://www.petri.co.il/windows-server-2012-smb-3-file-shares.htm
    Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Three way calling..... Problems....!!!

    The problem is when you merge 2 parties into one; it is either you hear nothing at all from both parties, or you only can talk to 1 person putting the other person on hold. Simply, "merge" just does not work.
    I called at&t 10 times to find a solution, still no go.
    Talking to a service representatives did not help much. What they do is that they just remove 3 way call feature and put it back on to your account from their at&t system, or they suggest power cycle the phone, or call apple.(duh!) At times, it worked momentarily then voila, the same problem continues.
    Then I talked to a tech support, I do not know what it is called but the tech disconnected my iPhone 3g from the network and reconnected it. She said this process is different from partial remove/add features that customer support rep did, it was rather total reset from the network.
    Right after the talk with tech support, I was able to connect & merge 3 people (my friends) together that I could not before. Next day, I tried three way calling for the same 3 people but it did not work ever since.
    I test called three way call today, calling 611 and Apple iPhone support number 800-694-7400, and it works! However, problem still exists when I try to connect my friends, the same 3 people mentioned above. What gives?
    Does the problem have something to do with my friends' carriers? One has T-mo, the other one has Helio, and the third has vonage VOIP home service.
    Please let me know.

    bump

  • Three way video chat

    I have v. 3.1.8 and am on a Macbook pro. I start a video chat with another macbook pro and try to bring a G4 into the conversation but I keep getting the "There is already another conference active" message. From what I remember, you just need to intel machines to make this work - am I wrong in thinking that? Even still, sometimes it seems like regardless of the computer configurations, three way chats sometimes will just give that message anyway. Is there something else that I may be doing to screw this up? Thanks in advance.

    Check each user is having an upload speed of at least 384k
    Check it user/ Buddy is displaying stacked Video icons
    See the Pink iChat 3 box and the third and fourth Buddy here
    http://www.ralphjohnsuk.dsl.pipex.com/page8.html
    One has the "Flat" single chat icon and one the "Stacked" multichat icon.
    If you are the one with the single "flat" icon then run the Cron scripts
    http://discussions.apple.com/thread.jspa?threadID=122021
    10:18 PM Sunday; May 13, 2007

  • Three Way Video Problem

    My mom sends a video invite to my sister from her iMac to her MacBook. Then my mom sends me an invite. On their Mac's iChat enters a three way chat where on my MacBook Pro all I see is myself and I can only hear them. If I have my mom start a two way video chat, I can then see her.

    Assuming each of you has his/her QuickTime Streaming Speed set correctly, the problem is probably insufficient bandwidth on your mother's end and possibly on your end as well.
    If you want to try a three-way video connection hosted by me, you can try video connecting to me at [email protected]

  • Three Way Color Corrector: turn off green clipping info in program monitor???

    How can I turn off the green indicator in the program window, that highlights my blacks that contain no image information. I applied a three-way-color corrector via an adjustment layer. Many thanks!

    Hi Joe,
    I am running on a MacBook Pro, OSX 10.8.3, my graphics card is:
      Chipset Model:          Intel HD Graphics 3000
      Type:          GPU
      Bus:          Built-In
      VRAM (Total):          512 MB
      Vendor:          Intel (0x8086)
      Device ID:          0x0116
      Revision ID:          0x0009
      gMux Version:          1.9.23
    I shot on a flat picture profile with a Nikon D800 and played with the input levels in the 3-way-color corrector. Again, if I brighten the whole image, these indicators will disappear; if I darken the image, they will grow. It is not an artefact, it is a way to show me my crushed blacks. Like a zebra function in cameras. I just cannot find a way to turn this off.
    Thanks again,
    Carl

  • Three Way Shuttle

    Hi all,
    I am looking for ideas on how I can implment a three-way shuttle.
    I want to start with a simple list of people (select person_id, name from per_person order by 1) and be able to shuttle from this list into one of two targets.
    The easiest example I can think of is a list of people invited to a meeting. For each person I want to shuttle them into either the 'Attendee' list or the 'Apologies' list (or potentially a 'No Show' list with a four way shuttle), obviuosly each person can only appear in a one list at any one time.
    We are using Version 3.1.
    Many thanks,
    Martin

    Hi Martin,
    My first thought was: I wouldn't use a shuttle for that, because how does it know where the person needs to go to when you click on an icon?
    So the three ideas that spring in my mind:
    - You could use a DHTMLX Tree component to drag-drop from one list to another
    http://dhtmlx.com/docs/products/dhtmlxTree/index.shtml
    Or
    - What if you create a list (div section) with your persons on the left and next to that 3 empty lists (div sections) with Attendee, Apologies and No Show. From your list of people you drag-drop to the other sections.
    - What is wrong with just a tabular form with a select list next to all the persons with the 3 options? That would be the easiest solution of course, but maybe not the nicest, web 2.0...
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/

  • Three way calls issue

    Hello,
    I am having difficulty with my phone. First problem. I can make three way calls, but I can't end a call with one person without having to end the call with both individuals. I was on a very important phone call today, long distance, and this really messed me up! Second, when someone calls me, and I put that person on hold to answer another incoming call, when I end the conversation with that incoming call I have to hang up on the other caller on hold!
    I have Verizon. Does any one else have this problem??
    Please help. It is so frustrating.

    Verizon is a CDMA carrier, so your options are limited.  This describes (from the iPhone User Manual):

Maybe you are looking for