C M P   2 . 0  
Finder and ejbSelect Declaration 
The declaration of finders has not changed in CMP 2.0. Finders are still declared in the 
home interface (local or remote) of the entity. Finders defined on the local home interface do 
not throw a RemoteException. The following code declares the findBadDudes finder on the 
GangsterHome interface: 
public interface GangsterHome extends EJBLocalHome { 
   
Collection
findBadDudes
(int badness) 
throws FinderException
; 
} 
Listing 9 12, Finder Declaration 
The ejbSelect methods are declared in the entity implementation class, and must be public 
abstract just like cmp field and cmr field abstract accessors. Select methods must be 
declared to throw a FinderException, but not a RemoteException. The following code 
declares an ejbSelect method: 
public abstract class GangsterBean implements EntityBean { 
   public 
abstract
Set
ejbSelectBoss
(String name) 
throws FinderException
; 
} 
Listing 9 13, ejbSelect Declaration 
EJB QL Declaration 
The EJB 2.0 specification requires that every ejbSelect or finder method (except 
findByPrimaryKey) have an EJB QL query defined in the ejb jar.xml file.
 6
  The EJB QL 
query is declared in a query element, which is contained in the entity element. The following 
is the declaration for the queries defined in Listing 9 12 and Listing 9 13: 
 
    
       
         GangsterEJB 
          
             
               
findBadDudes
 
               
int
 
             
            
>
               SELECT OBJECT(g) 
               FROM gangster g 
               WHERE g.badness > ?1 
            ]]>
 
          
          
             
                                                                          
6
 Currently this is not enforced by JBossCMP, but a future release will enforce this by throwing an exception during deployment. 
95






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

best web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved