• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chapter 7 - HF study group

 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For discussion of Head First EJB's Chapter 7.

Other Chapter discussions:
1 2 3 4 5 6 7
 
gayle craig
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P 397

"The two select methods ... doesn't say WHAT the methods will return... but we'll tell the container that one will return a Collection of Movies and one a Collection of Strings."

Where/how do we tell the container that? Does the container just know based on the EJB-QL that we write? Or from something else?
 
gayle craig
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
p 407 Sharpen your pencil

[LEGAL] SELECT OBJECT (m) FROM MovieSchema m

[LEGAL] SELECT m.title FROM MovieSchema m

[NOT LEGAL] SELECT m FROM MovieSchema m

[NOT LEGAL] SELECT OBJECT (m.title) FROM MovieSchema m


Is that right?
 
gayle craig
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So how do we go about defining in the Deployment Descriptor something where Bean A has more than one relationship (i.e. Bean A has a relationship with Bean B and Bean C)? There will be more than one ejb-relationship-role definition for A I assume? And there will be more than one ejb-relation tag, also?


Let's say there's a 1 to many between A and B. And Many to Many between A and C.
A B
(1) ------ (*)

A C
(*) ------ (*)

I think it would be like this. Is this right?


[ March 20, 2005: Message edited by: gayle craig ]
 
Ganeshji Marwaha
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by gayle craig:
P 397

"The two select methods ... doesn't say WHAT the methods will return... but we'll tell the container that one will return a Collection of Movies and one a Collection of Strings."

Where/how do we tell the container that? Does the container just know based on the EJB-QL that we write? Or from something else?


Yes, we tell the container in the EJBQL...
Remember,
1. we use *OBJECT(M)* in the Select statement to return a component interface type.
2. we use *m.xxxx* in the select statement to return a particular data type(like a string).

Hope this answers your question.
 
Ganeshji Marwaha
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by gayle craig:
So how do we go about defining in the Deployment Descriptor something where Bean A has more than one relationship (i.e. Bean A has a relationship with Bean B and Bean C)? There will be more than one ejb-relationship-role definition for A I assume? And there will be more than one ejb-relation tag, also? [ March 20, 2005: Message edited by: gayle craig ]


I didnt go through the full syntax of the code in the *relationships* tag. But the concept is right. that is exactly how u will be informing the container about the multiple relationships a bean has...
 
Gemini Moses
Ranch Hand
Posts: 245
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by gayle craig:
p 407 Sharpen your pencil

[LEGAL] SELECT OBJECT (m) FROM MovieSchema m

[LEGAL] SELECT m.title FROM MovieSchema m

[NOT LEGAL] SELECT m FROM MovieSchema m

[NOT LEGAL] SELECT OBJECT (m.title) FROM MovieSchema m


Is that right?


This is correct.

Gemini
[ March 22, 2005: Message edited by: Gemini Moses ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic