Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Chapter 7 - HF study group

 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • 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
 
Ranch Hand
Posts: 35
  • 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
  • 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
  • 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 ]
 
Greenhorn
Posts: 27
  • 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
  • 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...
 
Ranch Hand
Posts: 245
  • 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 ]
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic