what does this mean?Path expressions that contain NULL values during evaluation return NULL values.
About Question enthuware.oce-jpad.v6.2.501 :
Moderator: admin
-
- Posts: 11
- Joined: Fri Jan 23, 2015 5:05 am
- Contact:
About Question enthuware.oce-jpad.v6.2.501 :
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.501 :
For example, if you have e.contactInfo.address.zipcode in a query and if address is null for a particular employee, e.contactInfo.address.zipcode will return null.
If you like our products and services, please help us by posting your review here.
-
- Posts: 11
- Joined: Fri Jan 23, 2015 5:05 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.501 :
Got it. Thanks for the clarification.
-
- Posts: 18
- Joined: Sun Jun 21, 2015 2:56 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.501 :
Could you give some examples for such comparisons?Comparison or arithmetic operations with a NULL value always yield an unknown value.
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.501 :
For example, if you have AGE>30 in your sql, and if the AGE column contains nulls, then it is not guarantee whether the comparison will return true or false. Similarly for arithmetic operations, something like select AGE+10 from EMPLOYEE. Here, you should not rely on the values returned by the query.
If you like our products and services, please help us by posting your review here.
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.501 :
Just want to add my notes to explain these options.
I create three rows in InterestGroup table (id, description, name):
1 null null
2 null bigdata
3. AI AI
To demo option 1 compare non null with null , I create a JPQL :.
You may think the result is 1 and 2.
But the result is
1 and 2 are not returned because their null description compares with 'AI' is unknown.
To demo option 2 compare two null value, I create
You may think 1 is returned.
But the result is
1 is not returned because a null description is not equal to a null name.
To demo option 3,
Result :
or
Result
I create three rows in InterestGroup table (id, description, name):
1 null null
2 null bigdata
3. AI AI
To demo option 1 compare non null with null , I create a JPQL :
Code: Select all
select ig from InterestGroup ig where ig.description != 'AI'
You may think the result is 1 and 2.
But the result is
Code: Select all
[ArrayList Size=0]
To demo option 2 compare two null value, I create
Code: Select all
select ig from InterestGroup ig where ig.description = ig.name
But the result is
Code: Select all
[InterestGroup : asso_attrib_overrides.InterestGroup[ id=3 ]]
To demo option 3,
Code: Select all
select ig from InterestGroup ig where ig.description is NULL
Code: Select all
[InterestGroup : asso_attrib_overrides.InterestGroup[ id=1 ]]
[InterestGroup : asso_attrib_overrides.InterestGroup[ id=2 ]]
Code: Select all
select ig from InterestGroup ig where ig.description is NOT NULL
Code: Select all
[InterestGroup : asso_attrib_overrides.InterestGroup[ id=3 ]]
Who is online
Users browsing this forum: No registered users and 4 guests