I guess the other thing is if all the fieds are fetched as part of this, it
could save the second call that is made to the database when necessary....

Basically, what jonas does currently is

Select id from table where criteria,

followed by a loop over this and a

findbyprimarykey(for each id)

Now, you need to search for an existing cached ejb associated with your
transaction in the find by, but you should be able to leverage the result from
the first database query instead of having to issue a second....

As a side note, we've modified our GenIC tools to elminate some of the
unecessary additional looping that goes on as part of the bean fetching. I've
attached those files as a submission... This reduced CPU usage in my tests by
5%...

Is there a better way to make submissions?

Thanx,
-gabe

"Halas, Miroslav" wrote:

> Seems like this is problem appearing on Jonas list over and over. Jonas
> team, does EJB spec prohibits you to construct the initial SELECT statement,
> whech fetch the keys to contains the ORDER BY columns?
>
> Miro Halas
>
> -----Original Message-----
> From: Jackie Manning [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 22, 2000 7:47 AM
> To: [EMAIL PROTECTED]
> Subject: Ordering of finder results
>
> What is the proper way to order finder result sets for container managed
>
> entity beans in jonas?  I have tried appending the order by clause to
> the
> end of the finder spec in the bean properties, but this does not work
> consistently from database to database, at least one, Informix, requires
>
> columns in the order by clause to be in the selected columns.  It seems
> jonas normally only selects the primary key columns.
>
> Any help would be appreciated.   This could be a show stopper for us.
>
> ----
> This list is cross-posted to two mail lists.  To unsubscribe,
> follow the instructions below for the list you subscribed to.
> For objectweb.org: send email to [EMAIL PROTECTED] and
> include in the body of the message "unsubscribe ejb-container-group".
> For enhydra.org: send email to [EMAIL PROTECTED] and include
> in the body of the message "unsubscribe ejb-container-group".
/*
 * The contents of this file are subject to the JOnAS Public License Version 
 * 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License on the JOnAS web site.
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.
 * See the License for the specific terms governing rights and limitations under 
 * the License.
 *
 * The Original Code is JOnAS application server code released July 1999.
 *
 * The Initial Developer of the Original Code is Bull S.A.
 * The Original Code and portions created by Bull S.A. are
 *    Copyright (C) 1999 Bull S.A. All Rights Reserved.
 *
 * Contributor(s): ______________________________________.
 *
 * --------------------------------------------------------------------------
 * $Id: GenICEntityCMbyJDBCHome.java,v 1.1 1999/10/28 14:07:10 bassetre Exp $
 * --------------------------------------------------------------------------
 */


package org.objectweb.jonas.tools;


import java.lang.String;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import org.objectweb.jonas.common.Trace;
import org.objectweb.jonas.lib.BeanNaming;
import org.objectweb.jonas.lib.DD;
import org.objectweb.jonas.lib.JavaType;


/**
 *  This class allows to generate the source of the class that implements
 *  the Enterprise bean's Home interface of a given Entity Enterprise Java Bean
 *  with container managed persistence by JDBC.
 *  Its extends GenICEntityCMHome class, itself extends GenICEntityHome class,
 *  itself extends GenICHome.
 */
class GenICEntityCMbyJDBCHome extends GenICEntityCMHome {

    String dbTableName = null;

    /**
     * GenICEntityCMbyJDBCHome Constructor
     *
     * @param dd       deployment descriptor of the Entity Enterprise Java Bean
     *                 with container managed persistence by JDBC
     * @param fileName name of the source file of the class to generate
     * @exception GenICException in error case
     */
    GenICEntityCMbyJDBCHome(DD dd, String fileName) throws GenICException {
        super(dd, fileName);
        // Get the database table name
        try {
            dbTableName = ddesc.getDBTableName();
        } catch (Exception e) {
            throw new GenICException(e.getMessage());
        }
    }

    /**
     * Source generation of the import clauses
     * @exception GenICException in error case
     */
    void genImport() throws GenICException {
        src.println("import java.lang.Error;");
        src.println("import java.lang.Object;");
        src.println("import java.lang.RuntimeException;");
        src.println("import java.rmi.RemoteException;");
        src.println("import java.sql.Connection;");
        src.println("import java.sql.PreparedStatement;");
        src.println("import java.sql.ResultSet;");
        src.println("import java.sql.SQLException;");
        src.println("import java.util.Enumeration;");
        src.println("import javax.ejb.EJBObject;");
        src.println("import javax.ejb.FinderException;");
        src.println("import javax.ejb.ObjectNotFoundException;");
        src.println("import javax.ejb.deployment.EntityDescriptor;");
        src.println("import javax.sql.DataSource;");
        src.println("import org.objectweb.jonas.container.JEntityHome;");
        src.println("import org.objectweb.jonas.container.EntityContextImpl;");
        src.println("import org.objectweb.jonas.lib.CollectionEnum;");
        src.println("import org.objectweb.jonas.common.Trace;");
    }

    /**
     * Source generation of the ejbFindByPrimaryKey() method associated to the given
     * findByPrimaryKey() method described in the Home interface
     * @exception GenICException in error case
     */
    void genEjbFindByPK(Method method) throws GenICException {

        Class params[] = method.getParameterTypes();

        src.print  ("synchronized private " + ejbPrimaryKeyName + " pk" +
                    BeanNaming.firstToUpperCase(method.getName()) +
                    "(");
        for (int p=1; p <= params.length; p++) {
            src.print(JavaType.getName(params[p-1]) + " " + "p" + p, false);
            if (p < params.length) {
                src.print(", ", false);
            }
        }
        src.print  (") ", false);
        src.println(" throws java.rmi.RemoteException, javax.ejb.FinderException {", 
false);
        // core
        src.indentPlus();
        src.print  ("Trace.outln(Trace.DB_15, \""+wrpHomeBaseName+".pk"+
                    BeanNaming.firstToUpperCase(method.getName())+"(");
        for (int p=1; p <= params.length; p++) {
            src.print(JavaType.getName(params[p-1]), false);
            if (p < params.length) {
                src.print(", ", false);
            }
        }
        src.println(")\");", false);
        src.println("Connection conn = null;");
        src.println("PreparedStatement pStmt = null;");
        src.println("try {");
        src.indentPlus();
        src.println("conn = ((DataSource)getDataSource()).getConnection();");
        src.print  ("pStmt = conn.prepareStatement(\"select ");
        try {
            for (int i=0; i<fieldsPK.length; i++) {
                if (i > 0) {
                    src.print(", ", false);
                }
                src.print(ddesc.getDBFieldName(fieldsPK[i]), false);
            }
            src.print (" from " + dbTableName + " where ", false);
            for (int i=0; i<fieldsPK.length; i++) {
                if (i > 0) {
                    src.print(" and ", false);
                }
                src.print(ddesc.getDBFieldName(fieldsPK[i]) +
                          "=?", false);
            }
            src.println("\");", false);
            for (int i=0; i<fieldsPK.length; i++) {
                int index = i + 1;
                String methName = JavaType.getSQLSetMethod(fieldsPK[i].getType());
                String attrName = "p1."+fieldsPK[i].getName();
                String castS;
                if (JavaType.isXxxObjectMethod(methName)) {
                    castS = "(java.lang.Object)";
                } else {
                    castS = "";
                }
                src.println("pStmt."+ methName +
                            "(" + index + ", " + castS + attrName + ");");
            }
        } catch (Exception e) {
            throw new GenICException(e.getMessage());
        }
        src.println("ResultSet rs = pStmt.executeQuery();");
        src.println("if (rs.next() == false) {");
        src.indentPlus();
        src.println("Trace.errln(\"Object not found in database ("+
                    method.getName()+")\");");
        src.println("throw new ObjectNotFoundException(\"Object not found in database 
("+
                    method.getName()+")\");");
        src.indentMinus();
        src.println("}");
        src.indentMinus();
        src.println("} catch (SQLException e) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to find bean from database ("+
                    method.getName()+")\");");
        src.println("Trace.errln(e);");
        src.println("throw new FinderException(\"Failed to find bean from database ("+
                    method.getName()+")\");");
        src.indentMinus();
        src.println("} finally {");
        src.indentPlus();
        src.println("if (pStmt != null) {");
        src.indentPlus();
        src.println("try {");
        src.indentPlus();
        src.println("pStmt.close();");
        src.indentMinus();
        src.println("} catch (Exception ignore) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to close the PreparedStatement ("+
                    method.getName()+")\");");
        src.println("Trace.errln(ignore);");
        src.indentMinus();
        src.println("}");
        src.indentMinus();
        src.println("}");
        src.println("if (conn != null) {");
        src.indentPlus();
        src.println("try {");
        src.indentPlus();
        src.println("conn.close();");
        src.indentMinus();
        src.println("} catch (Exception ignore) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to close the Connection ("+
                    method.getName()+")\");");
        src.println("Trace.errln(ignore);");
        src.indentMinus();
        src.println("}");
        src.indentMinus();
        src.println("}");
        src.indentMinus();
        src.println("}"); // try-catch-finally
        src.println("return(p1);");
        src.indentMinus();
        src.println("}");
    }

    /**
     * Source generation of the ejbFindXXX() method associated to the given
     * findXXX() method described in the Home interface
     * @exception GenICException in error case
     */
    void genEjbFindOther(Method method) throws GenICException {

        boolean isWithCollection = ! method.getReturnType().equals(ejbRemoteClass);
        Class params[] = method.getParameterTypes();

        if (isWithCollection) {
            src.print  ("synchronized private CollectionEnum" + 
                        " pk" + BeanNaming.firstToUpperCase(method.getName()) +
                        "(");
        } else {
            src.print  ("synchronized private " + ejbPrimaryKeyName +
                        " pk" + BeanNaming.firstToUpperCase(method.getName()) +
                        "(");
        }
        for (int p=1; p <= params.length; p++) {
            src.print(JavaType.getName(params[p-1]) + " " + "p" + p, false);
            if (p < params.length) {
                src.print(", ", false);
            }
        }
        src.print  (") ", false);
        src.println(" throws java.rmi.RemoteException, javax.ejb.FinderException {", 
false);
        // core
        src.indentPlus();
        src.print  ("Trace.outln(Trace.DB_15, \""+wrpHomeBaseName+".pk"+
                    BeanNaming.firstToUpperCase(method.getName())+"(");
        for (int p=1; p <= params.length; p++) {
            src.print(JavaType.getName(params[p-1]), false);
            if (p < params.length) {
                src.print(", ", false);
            }
        }
        src.println(")\");", false);
        if (isWithCollection) {
            src.println("CollectionEnum pkC = new CollectionEnum();");
        } else {
            src.println(ejbPrimaryKeyName + " pk = " +
                        "new " + ejbPrimaryKeyName + "();");
        }
        src.println("Connection conn = null;");
        src.println("PreparedStatement pStmt = null;");
        src.println("try {");
        src.indentPlus();
        src.println("conn = ((DataSource)getDataSource()).getConnection();");
        src.print  ("pStmt = conn.prepareStatement(\"select ");
        try {
            for (int i=0; i<fieldsPK.length; i++) {
                if (i > 0) {
                    src.print(", ", false);
                }
                src.print(ddesc.getDBFieldName(fieldsPK[i]), false);
            }
            src.println(" from " + dbTableName + " " +
                        ddesc.getDBFinderWhereClause(method) + "\");",
                        false);
            for (int i=1; i <= params.length; i++) {
                String methName = JavaType.getSQLSetMethod(params[i-1]);
                String attrName = new String("p" + i);
                if (methName == null) {
                    throw new GenICException("Cannot container manage the bean's 
method '" +
                                             method +
                                             "' (Param '" + 
JavaType.getName(params[i-1]) + "')");
                }
                String castS;
                if (JavaType.isXxxObjectMethod(methName)) {
                    castS = "(java.lang.Object)";
                } else {
                    castS = "";
                }
                src.println("pStmt."+ methName +
                            "(" + i + ", " + castS + attrName + ");");
            }
            src.println("ResultSet rs = pStmt.executeQuery();");
            if (isWithCollection) {
                src.println("while (rs.next()) {");
                src.indentPlus();
                src.println(ejbPrimaryKeyName + " pk = " +
                            "new " + ejbPrimaryKeyName + "();");
                for (int i=0; i<fieldsPK.length; i++) {
                    String methName = JavaType.getSQLGetMethod(fieldsPK[i].getType());
                    String attrName = "pk."+fieldsPK[i].getName();
                    String dbclName = ddesc.getDBFieldName(fieldsPK[i]);
                    if (methName == null) {
                        throw new GenICException("Cannot container manage the bean's 
method '" +
                                                 method +
                                                 "' (Param '" + 
JavaType.getName(params[i-1]) + "')");
                    }
                    String castS;
                    if (JavaType.isXxxObjectMethod(methName)) {
                        castS = "("+JavaType.getName(fieldsPK[i].getType())+")";
                    } else {
                        castS = "";
                    }
                    src.println(attrName + " = " + castS + "rs." + methName +
                                "(\"" + dbclName + "\");");
                }
                src.println("pkC.addElement(findByPrimaryKey(pk, false));");
                src.indentMinus();
                src.println("}");
            } else {
                src.println("if (rs.next() == false) {");
                src.indentPlus();
                src.println("Trace.errln(\"Object not found in database ("+
                            method.getName()+")\");");
                src.println("throw new ObjectNotFoundException(\"Object not found in 
database ("+
                            method.getName()+")\");");
                src.indentMinus();
                src.println("}");
                for (int i=0; i<fieldsPK.length; i++) {
                    String methName = JavaType.getSQLGetMethod(fieldsPK[i].getType());
                    String attrName = "pk."+fieldsPK[i].getName();
                    String dbclName = ddesc.getDBFieldName(fieldsPK[i]);
                    String castS;
                    if (JavaType.isXxxObjectMethod(methName)) {
                        castS = "("+JavaType.getName(fieldsPK[i].getType())+")";
                    } else {
                        castS = "";
                    }
                    src.println(attrName + " = " + castS + "rs." + methName +
                                "(\"" + dbclName + "\");");
                }
            }
        } catch (Exception e) {
            throw new GenICException(e.getMessage());
        }
        src.indentMinus();
        src.println("} catch (SQLException e) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to find bean from database ("+
                    method.getName()+")\");");
        src.println("Trace.errln(e);");
        src.println("throw new FinderException(\"Failed to find bean from database ("+
                    method.getName()+")\");");
        src.indentMinus();
        src.println("} finally {");
        src.indentPlus();
        src.println("if (pStmt != null) {");
        src.indentPlus();
        src.println("try {");
        src.indentPlus();
        src.println("pStmt.close();");
        src.indentMinus();
        src.println("} catch (Exception ignore) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to close the PreparedStatement ("+
                    method.getName()+")\");");
        src.println("Trace.errln(ignore);");
        src.indentMinus();
        src.println("}");
        src.indentMinus();
        src.println("}");
        src.println("if (conn != null) {");
        src.indentPlus();
        src.println("try {");
        src.indentPlus();
        src.println("conn.close();");
        src.indentMinus();
        src.println("} catch (Exception ignore) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to close the connection ("+
                    method.getName()+")\");");
        src.println("Trace.errln(ignore);");
        src.indentMinus();
        src.println("}");
        src.indentMinus();
        src.println("}");
        src.indentMinus();
        src.println("}"); // try-catch-finally
        if (isWithCollection) {
            src.println("return(pkC);");
        } else {
            src.println("return(pk);");
        }
        src.indentMinus();
        src.println("}");
    }

}



/*
 * The contents of this file are subject to the JOnAS Public License Version 
 * 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License on the JOnAS web site.
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.
 * See the License for the specific terms governing rights and limitations under 
 * the License.
 *
 * The Original Code is JOnAS application server code released July 1999.
 *
 * The Initial Developer of the Original Code is Bull S.A.
 * The Original Code and portions created by Bull S.A. are
 *    Copyright (C) 1999 Bull S.A. All Rights Reserved.
 *
 * Contributor(s): ______________________________________.
 *
 * --------------------------------------------------------------------------
 * $Id: GenICEntityCMHome.java,v 1.1 1999/10/28 14:07:10 bassetre Exp $
 * --------------------------------------------------------------------------
 */


package org.objectweb.jonas.tools;


import java.lang.String;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import org.objectweb.jonas.common.Trace;
import org.objectweb.jonas.lib.BeanNaming;
import org.objectweb.jonas.lib.DD;
import org.objectweb.jonas.lib.JavaType;


/**
 *  This class allows to generate the source of the class that implements
 *  the Enterprise bean's Home interface of a given Entity Enterprise Java Bean
 *  with container managed persistence.
 *  Its extends GenICEntityHome class, itself extends GenICHome.
 */
abstract class GenICEntityCMHome extends GenICEntityHome {

    Field[] fieldsPK = null;

    /**
     * GenICEntityCMHome Constructor
     *
     * @param dd       deployment descriptor of the Entity Enterprise Java Bean
     *                 with container managed persistence
     * @param fileName name of the source file of the class to generate
     * @exception GenICException in error case
     */
    GenICEntityCMHome(DD dd, String fileName) throws GenICException {
        super(dd, fileName);
        // Get the list of the PrimaryKey fields
        // and check if all fields can be treated
        try {
            fieldsPK = ddesc.getFieldsOfPrimaryKey();
        } catch (Exception e) {
            throw new GenICException(e.getMessage());
        }
        for (int i = 0; i<fieldsPK.length; i++) {
            if ((JavaType.getSQLGetMethod(fieldsPK[i].getType()) == null) &&
                (JavaType.getSQLSetMethod(fieldsPK[i].getType()) == null)) {
                throw new GenICException("Cannot container manage the primary key's 
field '" +
                                         fieldsPK[i].getName() +
                                         "' (Type '" + 
JavaType.getName(fieldsPK[i].getType()) + "')");
            }
        }
    }

    /**
     * Source generation for the given create() method described in the Home interface
     * @exception GenICException in error case
     */
    void genCreate(Method method) throws GenICException {

        Class params[] = method.getParameterTypes();

        genHeaderMethod(method);
        src.println(wrpRemoteBaseName + " ejbobj;");
        src.println("ejbobj = new " + wrpRemoteBaseName + "(this);");
        src.println(ejbBeanName + " eb = null;");
        src.println("EntityContextImpl ctx = null;");
        src.println("try {");
        src.indentPlus();
        src.println("ctx = ejbobj.createContext();");
        src.println("eb = ("+ejbBeanName +")ctx.getInstance();");
        src.indentMinus();
        src.println("} catch (Exception e) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to create a new instance of the bean class 
"+ejbBeanName+"\");");
        src.println("Trace.errln(e);");
        src.println("throw new RemoteException(\"Failed to create a new instance of 
the bean class "+ejbBeanName+"\", e);");
        src.indentMinus();
        src.println("}");
        src.println(ejbPrimaryKeyName + " pk;");
        src.println("try {");
        src.indentPlus();
        src.print  ("eb.ejbCreate(");
        for (int p=1; p <= params.length; p++) {
            src.print("p" + p, false);
            if (p < params.length) {
                src.print(", ", false);
            }
        }
        src.println(");", false);
        genCatchBeanException(method, "ejbCreate");
        src.indentMinus();
        src.println("}");
        src.println("pk = new " + ejbPrimaryKeyName + "();");
        for (int f=0; f<fieldsPK.length; f++) {
            src.println("pk." + fieldsPK[f].getName() +
                        " = eb." + fieldsPK[f].getName() + ";");
        }
        src.println("ctx.setPrimaryKey(pk);");
        src.println("ejbobj.createData();");
        src.println("try {");
        src.indentPlus();
        src.print  ("eb.ejbPostCreate(");
        for (int p=1; p <= params.length; p++) {
            src.print("p" + p, false);
            if (p < params.length) {
                src.print(", ", false);
            }
        }
        src.println(");", false);
        genCatchBeanException(method, "ejbPostCreate");
        src.indentMinus();
        src.println("}");
        src.println("putEJBObject(pk, ejbobj);");
        src.println("return(ejbobj);");
        src.indentMinus();
        src.println("}");
    }

    /**
     * Source generation for the given findByPrimaryKey() method described in the Home 
interface
     * @exception GenICException in error case
     */
    void genFindByPK(Method method) throws GenICException {

        super.genFindByPK(method);

        Class params[] = method.getParameterTypes();
        Class exceptions[] = method.getExceptionTypes();

        /*
         * findByPrimaryKey(PrimaryKey p1, boolean callEjbFindByPK) Method
         */
        src.print  ("synchronized public " +
                    JavaType.getName(method.getReturnType()) +
                    " findByPrimaryKey(");
        for (int p=1; p <= params.length; p++) {
            src.print(JavaType.getName(params[p-1]) + " " + "p" + p, false);
            if (p < params.length) {
                src.print(", ", false);
            }
        }
        src.print(", boolean callEjbFindByPK) ", false);
        for (int e=1; e <= exceptions.length; e++) {
            if (e==1) {
                src.print("throws ", false);
            }
            src.print(exceptions[e-1].getName(), false);
            if (e < exceptions.length) {
                src.print(",", false);
            }
            src.print(" ", false);
        }
        src.println("{", false);
        // begining of the core
        src.indentPlus();
        src.println(wrpRemoteBaseName + " ejbobj = (" +
                    wrpRemoteBaseName + ")getEJBObject(p1);");
        src.println("if (ejbobj != null) {");
        src.indentPlus();
        src.println("return((" + ejbRemoteName+ ") ejbobj);");
        src.indentMinus();
        src.println("}");
        src.println("ejbobj = new " + wrpRemoteBaseName + "(this);");
        src.println("EntityContextImpl ctx = null;");
        src.println("try {");
        src.indentPlus();
        src.println("ctx = ejbobj.createContext();");
        src.indentMinus();
        src.println("} catch (Exception e) {");
        src.indentPlus();
        src.println("Trace.errln(\"Failed to create a new instance of the bean class 
"+ejbBeanName+"\");");
        src.println("Trace.errln(e);");
        src.println("throw new RemoteException(\"Failed to create a new instance of 
the bean class "+ejbBeanName+"\", e);");
        src.indentMinus();
        src.println("}");
        src.println(ejbPrimaryKeyName + " pk;");
        src.println("if (callEjbFindByPK) {");
        src.indentPlus();
        src.println("pk = pkFindByPrimaryKey(p1);");
        src.indentMinus();
        src.println("} else {");
        src.indentPlus();
        src.println("pk = p1;");
        src.indentMinus();
        src.println("}");
        src.println("ctx.setPrimaryKey(pk);");
        src.println("putEJBObject(pk, ejbobj);");
        src.println("return(ejbobj);");
        src.indentMinus();
        src.println("}");

        src.println();
        genEjbFindByPK(method);
    }

    /**
     * Source generation of the ejbFindByPrimaryKey() method associated to the given
     * findByPrimaryKey() method described in the Home interface
     * @exception GenICException in error case
     */
    abstract void genEjbFindByPK(Method method) throws GenICException;

    /**
     * Source generation for the given findXXX() method described in the Home interface
     * @exception GenICException in error case
     */
    void genFindOther(Method method) throws GenICException {

        Class params[] = method.getParameterTypes();
        boolean isWithCollection = ! method.getReturnType().equals(ejbRemoteClass);
        System.out.println("//Kovair Modified GenIC");
        src.println("//Kovair Modified GenIC");            
        genHeaderMethod(method);
        if (!isWithCollection) {
            src.println(ejbRemoteName + " ejbobj = null;");
            src.println(ejbPrimaryKeyName + " pk;");
            src.print  ("pk = pk" +
                        BeanNaming.firstToUpperCase(method.getName()) +
                        "(");
            for (int p=1; p <= params.length; p++) {
                src.print("p" + p, false);
                if (p < params.length) {
                    src.print(", ", false);
                }
            }
            src.println(");", false);
            src.println("ejbobj = findByPrimaryKey(pk, false);");
            src.println("return(ejbobj);");
        } else {
            // findXXX() method with a Collection
            boolean isEnumerationReturnType = 
method.getReturnType().equals(java.util.Enumeration.class);
            if (isEnumerationReturnType) {
                src.println("CollectionEnum ejbobjV = null;");
            } else {
                //java.util.Collection
                src.println("java.util.Vector ejbobjV = null;");
            }
            src.println(ejbPrimaryKeyName + " pk;");
            src.print  ("ejbobjV = pk" +
                        BeanNaming.firstToUpperCase(method.getName()) +
                        "(");
            for (int p=1; p <= params.length; p++) {
                src.print("p" + p, false);
                if (p < params.length) {
                    src.print(", ", false);
                }
            }
            src.println(");", false);
            src.println("return(ejbobjV);");
        }
        src.indentMinus();
        src.println("}");

        src.println();
        genEjbFindOther(method);
    }

    /**
     * Source generation of the ejbFindXXX() method associated to the given
     * findXXX() method described in the Home interface
     * @exception GenICException in error case
     */
    abstract void genEjbFindOther(Method method) throws GenICException;

}


begin:vcard 
n:Lawrence;Gabriel
tel;work:(408) 491-9731 Ext 207
x-mozilla-html:FALSE
org:Kovair<br>The power to .wow your customers.
version:2.1
email;internet:[EMAIL PROTECTED]
title:Architect
note:The power to .wow your customers.
adr;quoted-printable:;;2 North First Street =0D=0ASuite 212;San Jose;Ca;95113-1202;USA
x-mozilla-cpt:;15920
fn:Gabriel Lawrence
end:vcard

Reply via email to