This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The question Meg posted (page 430 - Q17) refers to Like expressions. If you check the EJB2.0 specification, page 230 says the following:
"The syntax for the use of the comparison operator [NOT] LIKE in a conditional expression is as follows:
single_valued_path_expression [NOT] LIKE pattern-value [ESCAPE escape-character]
The single_valued_path_expression must have a String value."
Although the question is not very clear, its asking whether the single_valued_path_expression used in LIKE expressions should result in String or not. As we can see from the specification it should, so the spoted alternative is indeed correct.
Hope this helps, Stefan
SCJP 1.4, SCBCD 1.3<br />IBM 141, 484, 486
Joined: Mar 12, 2002
Thanks for all replies.
The question Meg posted (page 430 - Q17) refers to Like expressions
Okay, it makes sense if the expression is "Like" But the question 17 is : What's true about EJB QL,IN expressions?
and correct answers are A,B So I think "A" should not be correct answer
Joined: Jul 31, 2004
As I don't have the book anymore to check, I tried to remember what kind of expression was the question refering to and I thought it was about LIKE expressions. My bad. Now I know it refers to the IN expression. The question does not make it clear, but given the correct answers we see it was refering to the IN expression used in the WHERE clause. I say this because page 229 (botton) of the specification states the rules for IN expressions used in WHERE clauses:
"The syntax for the use of the comparison operator [NOT] IN in a conditional expression is as follows: single_valued_path_expression [NOT] IN (string-literal [, string-literal]* ) The single_valued_path_expression must have a String value."