1 Reply Latest reply on Jun 11, 2007 5:09 AM by i o

    business methods and local home interface

    i o Newbie


      i declared a business method (it is actually a finder method, but the name is not findBlaBla) in the local home interface of an entity bean, and implemented it into the entity bean.

      deploying the application i get:

      Bean : Documento
      Method : public abstract Collection selectByMetadato(Integer, String)
      Section: 12.2.11
      Warning: Each local home method must match a method defined in the entity bean class.

      in fact, when i called it findByMetadato, hoping that JBossCMP would have used it as stated in the developer manual, the ejb-ql was used instead

      so why my implementation in the entity bean is not seen?

        • 1. Re: business methods and local home interface
          i o Newbie

          stub in the DocumentoLocalHome.java:

           public java.util.Collection selectByMetadato(Integer num, String metadati);
           // throws javax.ejb.FinderException;

          implementation as it appears in DocumentoBean.java:
           public java.util.Collection selectByMetadato(Integer num, String metadati) {
           DocumentoLocalHome documentoHome;
           java.util.Collection result = null;
           String sql = "SELECT DISTINCT documento.iddocumento" +
           "FROM documento join documento_metadatas_metadato_documents" +
           "on documento.idDocumento = documento_metadatas_metadato_documents.documento" +
           "join metadato on documento_metadatas_metadato_documents.metadato = " +
           "metadato.metadato" +
           "WHERE metadato.metadato IN (" + metadati + ")" +
           "GROUP BY documento.iddocumento, documento.titolo, documento.anno, "+
           "documento.tipo, documento.risorsa, documento.descrizione" +
           "HAVING count(*) = "+ num +";";
           ResultSet rset;
           rset = ServizioJdbc.ExecuteSql(sql);
           try {
           documentoHome = (DocumentoLocalHome) PortableRemoteObject.narrow(
           (new InitialContext()).lookup("DocumentoLocal"),DocumentoLocalHome.class);
           } catch (Exception e) {
           return null;
           try {
           while (! rset.isAfterLast() ) {
           } catch (Exception e) { System.out.println(e.toString()); return null; }
           return result;