Sitemap

Amicuk Programming Answers

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

2015-10-11   Views:0

Advertisement

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

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

The replay answer
Advertisement
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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Go to See the other 2 answers

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

Category:DefaultRelease time:2015-10-11Views:130

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[More]

AP:selected payment schedules report "Credit reduces payment amount  below

Category:DefaultRelease time:2015-10-11Views:130

Hi all: I have a PPR reject one Debit memo with reason "Credit reduces payment amount below zero" at first and shows out in report "selected payment schedules report" as Unselected Scheduled Payments. PPR Pay through date: 28-Nov-2011[More]

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

Category:DefaultRelease time:2015-10-11Views:130

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 youI'm not sure there is a solution to your ques[More]

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

Category:DefaultRelease time:-0001-11-30Views:130

How do I reduce the amount of email being sent to my iPhone 5 with iOS 7.0As I delete email more mail populates on the phone.Read other 3 answers[More]

SQL Query to reduce Commission amount on a Sales Order

Category:DefaultRelease time:-0001-11-30Views:130

I hope that this is the right forum to post this and hope that someone may be able to help? I have a customer who wants to manipulate the amount of commission given on a sales order for some specific items. I have set up a UDF on the item master reco[More]

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

Category:DefaultRelease time:-0001-11-30Views:130

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 optio[More]

Reducing the amount of code in htm pages :-)

Category:DefaultRelease time:-0001-11-30Views:130

Hi, I recently had to reduce the amount of abap business logic in a view. The view was in a large multifunctional bsp that someone else had written, and to which I needed to add some code. That view consisted of many htm includes, each include having[More]

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

Category:DefaultRelease time:-0001-11-30Views:130

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/Read other 2 answers[More]

How to reduce budgeted amount from IM program

Category:DefaultRelease time:-0001-11-30Views:130

HI, Is it possible to reduce budgeted amount from IM program (after distribution is done)? eg. original budget is 30k, need to reduce to 15k.. Is this possible? Or are there other means to reduce the budget? Many thanks in advance.Hi Irene, If the am[More]

Reducing the amount of space

Category:DefaultRelease time:-0001-11-30Views:130

I'm attempting to use some code like this to make a tabbed page. <cfformgroup type="tabnavigator" style="indicatorGap:0; verticalGap:3;"> <cfformgroup type="page" label="Contact Summary"> <cfformgroup[More]

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?

Category:DefaultRelease time:-0001-11-30Views:130

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[More]

Hot
Hi All, I have two Questions on the EPU Module. I'm using the version 11.1.2.2.300. Here are my questions. 1. Will the EPU Subroutine be triggered on (like the calculate and translate subroutine) hitting consolidation? 2. After hitting RunEPU or Forc [More]
I can't connect my ipod4 to itunes 9 on windows vista but it appears in the pc but doesn't appear in itunes  can somebody helpYes http://www.apple.com/itunes/download/Read other 4 answers [More]
Problems installing VadoCentral_MAC_APP_LA__2_3.zip on Mac? Preamble: st gen Vado HD macbook pro running OS X Snow leopard 0.6.2 I'm having a tough time installing the Vado Central SW on my Mac. I tried installing VadoCentral_MAC_APP_LA___0_df6, too. [More]
Hi, i am stuck in the failsafe mode or if i even try to login from the single user mode i need a text editor all the editors in solaris 10 are useless they are graphical but i am stuck in command line please guide me something simple such as vim in l [More]
I'm currently planning on purchasing an iPhone, but am just wondering whether the extra data plan charge(I'm currently an AT&T customer) is required to use the phone. I don't plan on using it for the internet or email, since I can just do that at hom [More]
Does any one know of software that you can import a PDF and then draw  on it, dimensions, notes and symbols...technical drawing?. Blue beam have the perfect software for this BUT it's not Mac compatibleYou need a PDF editor, at the high end use Adobe [More]
My photo app and some other apps closes when I try to do somerhing.Try This... Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again... Reset  ( No Data will be Lost ) Press and Hold the Sleep/Wake Button and the Home Button [More]
Hi, We have a customer who use sharepoint which is adjasted to mobile, and it seems that when user access in vpn or mobile  - it takes too much time till web parts are loaded. These are Content Search web parts that display pictures. Is there any set [More]
Dear all, I am having a big issue when installing oracle RAC on windows 2003 service pack 1. during oracle cluster configuration assistants step an error takes place and the installation terminate the following is the complete log file data. Using pa [More]
Good Day- We are up to integrate CCX7.0 with Oracle 10g, CCX7.0 documents show the way to integrate the CCX7.0 with SQL server, but mention nothing about Oracle 10g, anyway... I tried to check the ODBC options, there were many options, I tried to sel [More]