• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HFEJB EJB relationship question

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HF EJB page 429 question 13.
Can somebody please explain the meaning of these statements:

A. Path expression (.) is considered the navigation operator.

B. Path expression can terminate with cmr-field or cmp-field

D.Path expression can end with single value or collection value.

==============================================================
HF EJB page 430 question 17.
Can somebody please explain the meaning of this statement:

A.The single_valued_path_expression must be a String value.

In the specs its mentioned


single_valued_path_expression ::={single_valued_navigation | identification_variable}.cmp_field |
single_valued_navigation


I am not clear about single_valued_path_expression, please somebody help :
Thanks in advance.

[ May 20, 2005: Message edited by: Meg Adal ]
[ May 20, 2005: Message edited by: Meg Adal ]
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

if path expresion is like this "o.orders", it implies multi-valued_path_ expression.Because Orders is a collection.

if path expression is like this "o.name", it implies single-valued_path_ expression.Because name is String(always carries one value).

Hope it helps.

Thanks,
Prashant
 
Meg Adal
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

if path expression is like this "o.name", it implies single-valued_path_ expression.Because name is String(always carries one value).



But why it has to be String?
Can't I have expresion like "o.id" where id is "int" column is database?

Thanks in advance
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also do not get the real meaning of: single_valued_path_expression must be a String value. It can't be that the result must be a string since as Meg pointed out you can have o.intValue.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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
 
Meg Adal
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Any thoughts??
 
Stefan Guilhen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,

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."

So again, it expects a String value.

Stefan
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic