Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Van Nguyen

+ Follow
since Jan 28, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Van Nguyen

Hi Mitul,
Congrats on a great score. Sounds like you and I are on the same schedule.
I passed SCJP on 1/12, SCBCD yesterday and plan on taking the SCWCD on 4/26.
Good luck on the SCWCD.
16 years ago
My score isn't as impressive as most other's, but I'm still very proud to have passed the test today. I'm been attempting to learn EJBs of and one for a few years now but never really got it. It has always been presented as this really intimedating subject in books for years(IMHO). HFE has made EJBs excessible to me.
A huge thanks goes to K&B for making this happen for me.
My prep:
- HFE (read it twice)
- never looked at the spec
- never did any extra exam sims
Thanks to everyone at javaranch!
16 years ago
HFE p434 #12 - why is D correct?
does 'n' mean 0...* or 1...*?
if it means 1...* then D is correct
if it means 0...* then D is not correct, since it can return Orders with no line items.
Can someone clarify?
Can you elaborate? I currently, agree with everyone else that there is no method b2.getFoo() since it is unidirectional but would like to hear more of your arguement.
Are u saying there is a be.getFoo() which returns the comp object for Foo? If so, how do you account for the relationship being unidirectional?
Hi Christopher,
I got totally pissed off too.... hahaha. Step away from HFE...
Anyways, it is a typo, as confirmed by the errata(look for 369):
Hope this helps,
Walk Rustin
Hi Walker,
the client calls a method from it's remote component object which translates to an rmi call to the "bodyguard" on the container's server. So, the scenerio is either the client has called remove() but later on still uses the ref to the remote component object or the container removes the comp object, and the client has no way of knowing this until he calls on it remotely.
NoSuchObjectException inherits from RemoteException. My guess is NoSuchObjectException is much more informative but that which exception you actually get is container implementation specific.
Hope I didn't confuse things even more.
the container calls ejbStore() when it wants to be in sync (bean vs. entity) but since you are deleting the entity and "zeroing out" the bean and putting it back into the pool, you don't care what the state of the bean is, thus you need to write it's state back to the entity.
let's say you did call ejbStore() to update the state in the db ... then you would turn around and delete the same row from the db? wasted effort.
Hope this helps.
thanks for the reply cyril,
so you're saying
- public Integer ejbCreate() throws CreateException ... is legal
- public int ejbCreate() throws CreateExecption ... is not legal
I'll take a look at the spec. Thanks for your help.
Hi cyril,
thanks for the reply. I see the comment on p.321. I get it now. ejbRemove() brings it to pooled state. I was confused, I was assuming that ejbRemove() would bring it to "does not exist" state.
thanks very much for clearing that up for me.
16. Which additional method(s) might the container call when invoking ejbRemove?
e. ejbPassivate() - is not one of the answers. Why not?
My understanding is that after the container calls ejbActivate() - loads the data into the bean -calls ejbLoad() to tell the bean that it's been loaded. The bean/container deletes the entity in the db.
After this, doesn't the bean still exist? doesn't it go back into the pool so that it can be activated and loaded with another entities data? much like a stateless session bean? Thus I think ejbPassivate() may be called by the container.
If not the pool would shrink everytime an ejbRemove() is called.
Any thoughts?
5. Which are legal declarations for a CMP bean's ejbCreate methods?
d. public int ejbCreate() throws javax.ejb.CreateException
The book has it marked as not a valid declaration. I think it is, isn't it just overloading the create by returning an int? Can't I have something like:
public int ejbCreate() { = pkGenerator();
I'm alittle confused on the naming convention in this question
entity beans - refers to the actual row in the database not the bean pulled from the bean pool to play the role of the particular entity
entity object - refers to the object ref not the bean pulled from the bean pool to play the role of the particular entity
Am I right?
b. is true - how come? I see you can use getHandle() to get a handle but I don't see how you can use a handle to get a object ref. I know it must exist or else what good would getting a handle be. I just don't know what method you would call to convert a Handle to and Object ref.
c. is not true - why? can't I call get the object ref from findByPrimaryKey(pk) ?
Hi All,
I got it to work. The abstract getters/setters should affect the String and not the class. I was reaching when I tried it on the PK class. Now can someone explain to me why this works:
- in my ejbCreate(String,String) I called the abstract setter directly - this causes a CORBA error
- i changed the call inside ejbCreate to call my own setter which in turns calls the abstract setter - this works! of course, but shouldn't you be able to also call the abstract setter directly from ejbCreate?!!!
Hello All,
For the life of me, I haven't been able to get my CMP bean to work using a compound key. I'm confident my PK class is correct, it's my bean class that I have some confusion about. What do your abstract getters and setters look like? (if my pk is composed of 2 Strings
- do the abstract getter/setter affect the String? or the PK class? example:
public abstract void setName(String name);
public abstract String getName();
public abstract void setTitle(String title);
public abstract String getTitle();
public abstract void setEmployeePK(EmployeePK pk);
public abstract EmployeePK getEmployeePK();
Does anyone have cmp bean code that has a compound class what works on the RI?
If so please post your Bean and BeanPK src and anything "special" you had to do via the deploytool to get this working. I keep getting a CORBA error(vague) when I try to do a create.