aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes String Equality diffs bw EJB-QL and SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "String Equality diffs bw EJB-QL and SQL " Watch "String Equality diffs bw EJB-QL and SQL " New topic
Author

String Equality diffs bw EJB-QL and SQL

Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Hi all,

Spec (section 11.2.10) says that:

That comparison of strings should not be affected by their representation in the persistent store (eg, with regard to padding etc.). Two strings are equal if and only if they contain the same sequence of characters. This is different to SQL.


My question is: how is it different to SQL?
Does it mean that the following EJB-QL

select object(e)
from EmployeeSchema e
where e.firstName = 'John'


will return all employees with the first name of John even those that contain blank spaces (eg, employees with first name ' John ' will be selected)

while the following SQL

select *
from EmployeeTable
where FirstName = 'John'

will not select employees whose first names are not exactly John (eg, employees with ' John ' as the first name will not be selected)


Thanks to all in advance.


Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
It looks like you understand this. I've never run across the implications of this ... and I imagine that some containers just ignore it ... but yeah.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Thanks Nathaniel

I guess I should try this scenario on my app server (jboss) and see what happens. I get around it I'll let you know about the results.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String Equality diffs bw EJB-QL and SQL
 
Similar Threads
How to write SQL "IN" clause in EJB-QL
EJB place in SCEA exam
Convert this SQL to EJB QL
2 questions about EJB-QL
temporary tables