473,503 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Specifying the conditions for inner join at runtime using Filter

15 New Member
Say i have one-to-many relationship between Product and ProductNames
Product ----> PID (PK)
ProductNames------> PID, USECODE, STARTTIME as composite ID and ENDTIME is another normal column.

Now i want to fetch product with PID='1' and USECODE='100' and STARTTIME < CURRENTTIME < ENDTIME.

CURRENTTIME value will be known at runtime.

How to specify this in mapping and fetch Product & ProductNames using eager fetching?


ANS: Using Filters, this problem can be resolved. Define filter, attach filter and enable filter. Filter supports
specifying positional parameters value at runtime.
but i got 1 problem with filters :
Suppose i have 1 product with id as 100, it has 5 ProductNames..but when we apply filter only 2 productNames remains.

When i use just "inner join fetch" with no filters, it returns me one Product object which contains List of productNames properly
populated.
BUT When i use "select distinct product" and inner join fetch" with filter, it returns one product populated with productNames
list which contains 3 elements viz. null, first filtered productName, second filtered productName..

Why productNames list contains the first element as null? This seems to be a bug..
Apr 28 '09 #1
1 1742
pronerd
392 Recognized Expert Contributor
Sounds like this question should be posted in a forum for SQL or the DataBase you are using rather than for Java. Unless you are doing this with EJB entity beans or a similar frame work. Is that the case?
Apr 29 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3547
by: VisionSet | last post by:
I have a query with 4 tables and plain 'JOIN's the explain gives the best join order, and it completes in 1.5 secs I add a single ORDER BY (a calculated column) and the join orders all shift and...
6
1690
by: Pedro Alves | last post by:
Hi I'm having serious problems with a mission critical app that runs on postgres (and has been running for the past 3 years). It's rather large, and lately things are not going well. The...
0
1281
by: Joseph Shraibman | last post by:
I have a query like this: SELECT ... FROM u, d WHERE d.ukey = u.ukey AND <restrictions on u> AND (d.status = 3 OR (u.status = 3 AND d.status IN(2,5))); explain shows: -> Aggregate ...
1
3505
by: Martijn van Oosterhout | last post by:
Today I got the error: ERROR: FULL JOIN is only supported with mergejoinable join conditions Which is really annoying since a full join is exactly what I wanted. I guess the alternative is to...
6
9281
by: dmonroe | last post by:
hi group -- Im having a nested inner join problem with an Access SQl statement/Query design. Im running the query from ASP and not usng the access interface at all. Here's the tables: ...
18
5012
by: Dave | last post by:
Guys I am really stuck on this one. Any help or suggestions would be appreciated. We have a large table which seemed to just hit some kind of threshold. They query is somewhat responsive when...
0
1227
by: Ironr4ge | last post by:
Hi everyone, I was wondering whether is was possible to select only the filtered records of one form with Recordsource = "C" and open a diffrent form with recordsource "L" . The way I was...
6
3090
by: jackal_on_work | last post by:
Hi Faculties, I have two queries which give me the same output. -- Query 1 SELECT prod.name, cat.name FROM products prod INNER JOIN categories cat ON prod.category_id = cat.id WHERE cat.id...
12
25069
by: =?ISO-8859-1?Q?Ren=E9?= | last post by:
Hi, is there a rule of thumb what is better/faster/more performant in SQL Server 2005? a) SELECT * FROM A INNER JOIN B ON B.ID = A.ID AND B.Cond1 = 1 AND B.Cond2 = 2 b) SELECT * FROM A INNER...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.