• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chapter 1 - HF Sark study group

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

Other Chapter discussions:
1 2 3 4 5
[ February 18, 2005: Message edited by: Marc Peabody ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 1 Confirmed Errata:
(24) handwriting note on the upright;
in this book, we won't use the JAR tool to make the ejb-bar ourselves;
the "ejb-bar" should be "ejb-jar"
 
Bert Bates
author
Sheriff
Posts: 8905
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Marc,

Tell us about your study group!
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bert,
There are about 8 of us and we all work for the same company. Most of us are "little-to-no-experience" folk as far as EJBs go and hope to broaden our horizons.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make it Stick (exercise on page 13)
"There isn't one perfect right answer for these..."

* Booking a ticket - stateless session
* A bank account - entity
* Searching a product DB - stateless session
* Dating service match-ups - stateful session
* Receiving submitted expense reports... - message-driven
* Online expert diagnosis - stateless session
* The books in a library - entity

Anyone see these differently? If so, explain why.
 
Joe OBrien
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,

I agree ... somewhat.
I came up with entity for the product database (when they talked about each one representing a row in the db).

I also thought the online expert diagnosis would be stateful not stateless. With diagnosis you have a series of questions that seem to drill down to the eventual diagnosis. (i.e., do you have a fever - if so is there a cough with it, if so is it productive, etc...).

-Joe
 
Joe OBrien
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
disregard my statement about the product db ... i just saw my flaw in that logic.
 
Joe OBrien
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leave it to me to forget something that we talked about last week ...

For those of you like me who did forget about this, there is a bug that interacts with the RI Server in the Chapter One example.

If you rename your getAdvice() method in the AdviceBean to something else (like getTheMessage()) it will work (don't forget to change the Advice interface as well.).

See the errata
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a good point about the diagnosis program, Joe.

My original thinking was that the program doesn't need to know WHO you are (ie shopping cart) so it is stateless. But the point is it still needs to remember the transaction, even if your identity is irrelevant.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marc Peabody:
The Head First book is our main resource and we'll create a new thread topic for each chapter as we progress. This will continue at the rate of 2 chapters per week which will take us to the end of March 2005.

We hope that future SCBCD participants will benefit from these threads. Please cooperate by keeping topics within the chapter's test objectives.


Interesting preparatory style...

I hope that it will be effective to those who are preparing for the exam during the period... I do hope other forums will have some study group like this as well....
 
gayle craig
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the same answers as Marc on the Page 13 exercise.

I guess you already figured this out Joe, but to clarify the answer for "Searching a product DB".... the keyword here is Searching, i.e. an action, thus a session bean. As opposed to the DB, a noun, which would be an entity.

Interesting point about the diagnosis program, Joe. I was thinking of it like WebMD. You find a symptom or disease or whatever, click on it, and it gives you a page of information and it's done, which would be stateless. Yet if it was more in-depth like you describe, it seems it would need to be stateful. How did others interpret the BRIEF description of this online diagnosis app?

I found that I had a lot of trouble deciding between Message and Stateless Session, however. I'm not entirely sure why those two were particularly hard to distinguish.
 
gayle craig
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 22 Brain Power Exercise
"... Brainstorm a way (there may be more than one) in which you can handle the requirements of the Advice Guy bean...."

The only thing I could think of was to make a separate interface that has the methods used by both Advice and AdviceBean (this new interface does not extend the EJBObject interface). Advice and AdviceBean can both use this new interface. Then, Advice.java can also extend the EJBObject interface.

Did anyone think of any other ways?
 
Dean Stautberg
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by gayle craig:
Page 22 Brain Power Exercise
The only thing I could think of was to make a separate interface that has the methods used by both Advice and AdviceBean (this new interface does not extend the EJBObject interface). Advice and AdviceBean can both use this new interface. Then, Advice.java can also extend the EJBObject interface.


It sounds like you're saying that Advice would extend both the new interface and the EJBObject interface, which is not legal in most states (except maybe Alaska and Hawaii). Unfortunately I haven't come up with anything better...
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a drawn-up version of Gayle great answer, see page 86. Don't forget to read its disclaimer at the end of page 85.
 
Subhash Bhushan C
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For people using windows, you can include the classpath into your javac and java path, as follows:

E:\Java\SCBCD\Projects\Advice>javac -classpath %CLASSPATH%;AdviceApplClient.jar AdviceClient.java

E:\Java\SCBCD\Projects\Advice>java -cp %CLASSPATH%;AdviceApplicationClient.jar AdviceClient


Also, Page 22 Brain Power Exercise:

Requirement 1: interface Advice extends EJBObject
Requirement 2: class AdviceBean implements SessionBean
class AdviceBean (does not)implements Advice
Requirement 3: methods in AdviceBean == matches all = methods in Advice

Another way (though only slightly different) would be:


[ February 07, 2005: Message edited by: Agni Vartula ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic