473,651 Members | 2,765 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..b ut 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 1749
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
3567
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 the query takes 85secs! So I read the docs and it suggests STRAIGHT_JOIN to force join order. now I was using:
6
1699
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 planner is getting 'nuts', choosing ways that never end and completly stops the database. The strange thing is that running the same query with the same database
0
1292
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 (cost=126787.04..126787.04 rows=1 width=4) -> Hash Join (cost=39244.00..126786.07 rows=387 width=4) Hash Cond: ("outer".ukey = "inner".ukey)
1
3527
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 do a left join and a right join and merge them? Is it just that no-one has come up with a way to code this efficiently? Maybe someone has a better way to express this. The problem is I have
6
9304
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: tblEmployees empId -- EmpName -- EmpRole -- EmpManager -------....------------.... ---------....--------------- 1........ dan yella..........1..........2
18
5030
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 there are NO indexes on the table. However, when we index email the query takes forever. FACTS - The problem is very "data specific". I can not recreate the
0
1236
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 thinking accompleshing this was by using the following innerjoin statement.. and code to open form... ----------------------------------------------------------------------- Private Sub cmdFilter_Click() Dim strWhere As String 'The...
6
3100
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 = 1;
12
25110
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 JOIN B ON B.ID = A.ID WHERE B.Cond1 = 1 AND B.Cond2 = 2
0
8357
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8700
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6158
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.