2 Replies Latest reply on Jan 29, 2002 1:39 PM by Dain Sundstrom

    Generic findByPrimaryKey method

    Martin Stepanek Newbie

      Hi all,

      I'd like to call some methods of my entity beans without explicitly knowing their specific home/remote interface (only by knowing their JNDI).

      So, I've written 2 generic interfaces -- the 1st one is extended by all the home interfaces of my entity beans, the 2nd one by their remote interfaces. The generic home interface looks like that:

      public interface GenHome extends EJBHome {
      public GenRemote findByPrimaryKey(Integer pk);
      [other generic home methods]

      where the GenRemote is the generic remote interface.

      I then expected, it would be possible to call the entity beans finders in th following fashion:

      GenHome some_home;
      GenRemote some_entity;
      ... //here getting the some_home and the some_key somehow
      some_entity = some_home.findByPrimaryKey(some_key);
      ... //here doing with the some_entity something

      But I always get exception like:
      Unknown finder: public abstract cz.transoft.generic.ejb.TOMERemote cz.transoft.gis.ejbEBHypertext.EBHypertextHome.findByPrimaryKey(java.lang.Integer) throws java.rmi.RemoteException,javax.ejb.FinderException java.lang.reflect.UndeclaredThrowableException

      When I write EJB-QL for the findByPrimaryKey (but this is not correct, is it?), I get collection, but I want, of course simple remote interface instead.

      Can someone suggest solution to this, please?