Karin Paola Illuminate

Ranch Hand
+ Follow
since Oct 18, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Karin Paola Illuminate

I've got a question about ejb-ref and ejb-local-ref... An enterprise bean can refer to the homes of other enterprise beans using "logical" names called EJB references. References to other beans can be local or remote. But, message driven beans have no unique identity to clients � they don�t have clients (NO home interface, NO component interface, and no local vs. remote).

So, my question is : Is it possible to define a <ejb-ref> or a <ejb-local-ref> elment for message-driven beans??? I mean is it possible to define this in the DD WITHOUT a <home> and <remote> element for <ejb-ref> or a <local-home> and <local> for <ejb-local-ref>???

I also thought that the <ejb-ref-type> element should NOT be a message-driven bean (and that the <res-ref-type> could only be either �Session� or �Entity�).

Please, help me out. I'm confused... Confused

(I also posted this question on jdiscuss.)
The book Head First EJB says

Rules for the remote home interface
...
Declare one or more home business methods
�Arguments and return types must be RMI-IIOP compatible
�You can have overloaded methods
�Each method must declare a RemoteException
�You can declare your own application exceptions, but they must NOT be runtime exceptions (they must be compiler-checked exceptions)
�Methods can have arbitrary names, as long as they don�t begin with �create�, �find�, or �remove�.



Why can't I start a home business method with "remove"?

The book Head First EJB says also says :

Rules for the remote component interface
...
Declare one or more business methods that throw a RemoteException
�Arguments and return types must be RMI-IIOP compatible (Serializable, primitive, Remote, or arrays or collections of any of those)
�You can have overloaded methods
�Each method must declare a RemoteException
�You can declare your own application exceptions, but they must NOT be runtime exceptions (they must be compiler-checked exceptions � subclasses of Exception, but not subclasses of RuntimeExcepton)
�Methods can have arbitrary names, as long as they don�t begin with �ejb�.



Is it allowed to start a business method with "remove"?
Who knows the "Sharpen your pencil" answers? I can't find them on the Oreilly web site.

Circle the EJB-QL statement if it has a legal SELECT clause
SELECT OBJECT (m) FROM MovieSchema m
SELECT m.title FROM MovieSchema m
SELECT m from MovieSchema m
SELECT OBJECT (m.title) FROM MovieSchema m



Thanks in advance.
The book says (on page 403)

Using an optional WHERE clause

In the bean class
public abstract Collection ejbSelectGetAllMovies () throws FinderException;

In the deployment descriptor
SELECT OBJECT (m) FROM MovieSchema m WHERE m.genre = ?1



The errata says

(403) Method header;
Looks like the header got copied from the previous page. The header should be:

public abstract Collection findByGenre(String genre) throws FinderException;



Should it be In the home interface instead of In the bean class ?
[ December 22, 2004: Message edited by: Karin Paola Illuminate ]
I mean the book Head First EJB (HEF).



Think about the following operations, and figure out which of the two client interfaces (component or home), is better suited for each operation.

1 make a new customer
2 change an existing customer's phone number
3 find all the customers in pleasantville
4 delete all customers previously declared 'inactive'
5 delete a specific customer
6 get the street address of a specific customer



I was thinking about :

Operations 1, 3 and 4 for home interface, and operations 2, 5 and 6 for component interface.
Shouldn't there be a getActors() method in Movie?
HFE, p 487 says "Everything in UserTransaction is for BTM beans ONLY!" (begin, commit, getStatus, rollback, setRollbackOnly, setTransactionTimeout). HFE, p. 508 says "BMT is used by session beans and message-driven beans".

Does this mean that message-driven beans with BMT are allowed to call javax.ejb.EJBContext.getUserTransaction()?
You're completely right. And, I would like to. But, the problem is : it's a picture. But, thanks for your comments, anyway
The question is as follows :

Think about the following operations, and figure out which of the two client interfaces (component or home), is better suited for each operation.

1 make a new customer
2 change an existing customer's phone number
3 find all the customers in pleasantville
4 delete all customers previously declared 'inactive'
5 delete a specific customer
6 get the street address of a specific customer


[ September 28, 2004: Message edited by: Karin Paola Illuminate ]
I also added a ejbPostCreate() method and an ejbHomeGetLowStockItems(). How come this is not correct? I used the explaination on p. 314 to answer the question.
You're right. I cannot enter http://www.jdiscuss.com
What is the correct answer?

I've got

1 make a new customer
2 change an existing customer's phone number
3 find all the customers in pleasantville
4 delete all customers previously declared 'inactive'
5 delete a specific customer
6 get the street address of a specific customer

home: 1, 3, 4
component: 2, 5, 6
If I use a stateful session bean remove, I will get an advice and an exception. If I use a stateless session bean remove, I will get two times an advice.
If I use ByteArrayToDocument. Is it possible to parse the XML with SAX?