NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Problem with JPQL SELECT query

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
Xavier Callejas
Posted via mailing list.





PostPosted: Fri Jun 12, 2009 3:29 pm    Post subject: Problem with JPQL SELECT query Reply with quote

Hi,

I cannot make this query to work.

I need to do a LEFT OUTER JOIN but also include registers that has null values
in the relation field.

The following query returns 0 rows, but it should return 10 rows as I have 10
clients without country (null):

"SELECT t1 FROM Clients t1 LEFT OUTER JOIN t1.countries t2 WHERE t1.countries
IS NULL"

I need to do the LEFT OUTER JOIN becuase I would want to add:

"SELECT t1 FROM Clients t1 LEFT OUTER JOIN t1.countries t2 WHERE t1.countries
IS NULL OR t1.countries.name LIKE "%United%"

This last query sould show me the clients with country name '%united%' but
also the ones that have null in countries but it doesn't.

In native SQL (mysql) this same query with LEFT OUTER JOIN works as expected.

Please help me.

Thanks in advance.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo