• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Chapter 7 - HF study group

 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For discussion of Head First EJB's Chapter 7.

Other Chapter discussions:
1 2 3 4 5 6 7
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic