I don't know, but yours has 1 XDoclet tag to do the whole thing, I use 2 as
detailed in the XPetStore.
Try it the way I have it, and also note the Suggestions David just gave.



>As well, keep in mind the following:

>- Standard indexes are case-sensitive.

>- If you're using CHAR instead of VARCHAR2, Oracle adds trailing
>  spaces to pad it to the full length of the column.



-----Original Message-----
From: Natasha Varshney [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 26, 2004 11:17 AM
To: [EMAIL PROTECTED]
Subject: RE: [Xdoclet-user] finder method doesn't return anything from
DB! !


Hi Mike,
Here are the code snipet from the ejb-jar.xml and the
finder method declaration.
Do u think the way the ejb-ql is written in the
ejb-jar.xml is wrong!!
I tried doing the 
[CDATA[SELECT DISTINCT OBJECTS(a) FROM CriminalCMP AS
a WHERE a.lastName = ?1]] 
ejb-ql,but that doesn't work.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                 ejb-jar.xml
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<query>
<query-method>
<method-name>findByLastName</method-name>
<method-params>
           <method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
[CDATA[SELECT DISTINCT OBJECT(a) FROM CriminalCMP AS a
WHERE a.lastName = ?1]]
</ejb-ql>
</query>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
              finder-method declaration
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* @ejb.finder 
 *      view-type = "both"
 *      description = "find the Criminals by
PrimaryKey"
 *      signature = "com.criminalsearch.CriminalRemote
 findByPrimaryKey(Integer criminalPK)
 *      role-name = "Operator"
 *      query = "SELECT OBJECT(a) FROM
com.criminalsearch.Criminal AS a WHERE a.criminalPK =
?1"
 *      result-type-mapping = "Local"
 *      transaction-type = "Required"
 *      unchecked="true"
 * 
 * 
 * @ejb.finder 
 *      view-type = "both"
 *      description = "find the Criminals by LastName"
 *      signature = "java.util.Collection
findByLastName(java.lang.String lastName)
 *      role-name = "Operator"
 *      query = "SELECT DISTINCT OBJECT(a) FROM
Criminal AS a WHERE a.lastName = ?1"
 *      result-type-mapping = "Local"
 *      transaction-type = "Required"
 *      unchecked="true"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 


--- [EMAIL PROTECTED] wrote:
> I need to see the finder declaration in your XDoclet
> entity bean.
> 
> It should look something like this:
> ===================================
> 
>  * @ejb.finder   signature="java.util.Collection
> findAllSicCodes()"
>  *               query="SELECT DISTINCT OBJECT(c)
> FROM SicCode AS c"
>  *
>  * @ejb.finder signature="java.lang.String
> findSicCodeByBusinessTypeDescription(
> java.lang.String
> pBusinessTypeDescription )"
>  *             query="SELECT DISTINCT OBJECT(c) FROM
> SicCode AS c WHERE
> c.businessTypeDescription = ?1"
>  *
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Behalf Of Natasha
> Varshney
> Sent: Wednesday, May 26, 2004 12:41 AM
> To: [EMAIL PROTECTED]
> Subject: [Xdoclet-user] finder method doesn't return
> anything from DB!!
> 
> 
> Thanks Mick,
> 
> It did save me a lot of time.I have another issue.I
> have a bunch of finder methods(findByFirstName and
> findByLastName) in the Home Interface,but when I try
> to use these methods to get data 'already' present
> from Oracle DB,it doesn't get anything from the DB.
> But If I currently create a row and then do a
> findByFirstName ,it shows me the result.
> findByPrimaryKey works fine and it is able to
> retrive
> data successfully. 
> Any clue what is going on here??
> 
> Here is the snap code...
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>      Home Interface
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> public interface CriminalHome
>    extends javax.ejb.EJBHome
> {
>    public static final String
> COMP_NAME="java:comp/env/ejb/Criminal";
>    public static final String
> JNDI_NAME="ejb/CriminalHome";
> 
>    public com.criminalsearch.CriminalRemote create()
>       throws
> javax.ejb.CreateException,java.rmi.RemoteException;
> 
>    public com.criminalsearch.CriminalRemote
> create(java.lang.Integer criminalPk ,
> java.lang.String
> firstname , java.lang.String lastName)
>       throws
> javax.ejb.CreateException,java.rmi.RemoteException;
> 
>    public com.criminalsearch.CriminalRemote 
> findByPrimaryKey(java.lang.Integer criminalPK)
>       throws
> javax.ejb.FinderException,java.rmi.RemoteException;
>    
>    public Collection 
> findByLastName(java.lang.String
> lastName)
>           throws
> javax.ejb.FinderException,java.rmi.RemoteException; 
>  
>        
>    public Collection 
> findByFirstName(java.lang.String
> firstName)
>               throws
> javax.ejb.FinderException,java.rmi.RemoteException; 
>  
> 
> }
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>         Client
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> public class Client
> {
>    public static void main(String[] args) throws
> Exception
>     {
>         CriminalHome home = null;
>         CriminalRemote remote = null;
>         
>         try
>         {
>             Hashtable env = new Hashtable();
>            
>
env.put(Context.INITIAL_CONTEXT_FACTORY,weblogic.jndi.WLInitialContextFactor
> y.class.getName());
>             env.put(Context.PROVIDER_URL,
> "t3://localhost:7001"); 
>             env.put(Context.SECURITY_PRINCIPAL,
> "weblogic");
>             env.put(Context.SECURITY_CREDENTIALS,
> "weblogic");        
>             Context ctx = new InitialContext(env);
>             home = (CriminalHome)
> PortableRemoteObject.narrow
>            
> (ctx.lookup("ejb/CriminalHome"),CriminalHome.class);
>          
>            
>             Integer a = new Integer(55555);
>             Integer b = new Integer(66666);
>             Integer c = new Integer(88888);
>             Integer d = new Integer(99999);
>             Integer e = new Integer(77777);
>             home.create(a,"XXX","RRR");
>             home.create(b,"YYY","WWW");
>             home.create(c,"ZZZ","TTT");
>             home.create(d,"EEE","UUU");
>             home.create(e,"DDD","BBB");
>             
>              Collection c =
> home.findByFirstName("XXX");
>              Iterator i = c.iterator();
>             if(c.isEmpty()) 
>             {
>                 System.out.println("No Collection
> with
> First Name Found!!");
>             }
>             while(i.hasNext())
>              {
>              CriminalRemote criminal =
> (CriminalRemote) PortableRemoteObject.narrow
>                                          
> (i.next(),CriminalRemote.class);
>             // String firstName = 
> criminal.getPrimaryKey();
>              String lastName = 
> criminal.getLastName();
>              Integer driver_id =
> criminal.getDriver_Id();
>              Integer ssn = criminal.getSSN();
>              Integer pass_num =
> criminal.getPassport_Num();
>              Integer over_all_rating =
> criminal.getOver_All_Rating();
>              String Id_Marks = 
> criminal.getId_Marks();
>              System.out.println("Display of
> REMOTEXXX
> Object"+"\n"+lastName+"\n"+
>
driver_id+"\n"+ssn+"\n"+pass_num+"\n"+over_all_rating+"\n"+Id_Marks+"\n");
>            }
>              
>            Collection c1 =
> home.findByLastName("BBB");
>            Iterator i1 = c1.iterator();
>             if(c1.isEmpty()) 
>              {
>              System.out.println("No Collection with
> Last Name Found!!");
>               }
>             while(i1.hasNext())
>               {
>             CriminalRemote criminal =
> (CriminalRemote)
> PortableRemoteObject.narrow
>                                                 
> (i1.next(),CriminalRemote.class);
>              // String firstName = 
> criminal.getPrimaryKey();
>             String firstName = 
> criminal.getFirstName();
>             Integer driver_id =
> criminal.getDriver_Id();
>             Integer ssn = criminal.getSSN();
>             Integer pass_num =
> criminal.getPassport_Num();
>             Integer over_all_rating =
> criminal.getOver_All_Rating();
>             String Id_Marks = 
> criminal.getId_Marks();
>             System.out.println("Display of REMOTEBBB
> Object"+"\n"+firstName+"\n"+
>
driver_id+"\n"+ssn+"\n"+pass_num+"\n"+over_all_rating+"\n"+Id_Marks+"\n");
>             }
> Integer a = new Integer(23140);
>             remote = home.findByPrimaryKey(a);
>           
>             {
>               String firstName = 
> 
=== message truncated ===




        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to