1 Reply Latest reply on Mar 21, 2002 9:36 AM by mcauleyt

    ejbSelect returning $proxy type rather than local interface

    mcauleyt

      Hi,

      I am having a problem with an ejbSelect statement that I have written and I can't figure out what I am doing wrong. I really suspect that I'm missing something very fundamental but can't find it. Any help on this is appreciated as it is beginning to wreak my head a little.

      In brief:

      I have the following select statment:
      public abstract Set ejbSelectDialogClustersInQueue(Integer memberPk) throws FinderException;

      <![CDATA[
      SELECT mdc.dialogCluster
      FROM MemberEJB AS m,
      IN( m.clusters ) AS mdc
      WHERE m.memberPk = ?1
      ]]>

      Clusters is a cmr-field marked as a set. (All the relationships are setup).

      If I step through the returned set, the type of the object I get back is $Proxy26 (or some other number). Why is this... and how do I get the actual object i.e. DialogClusterLocal?

      EJB layout:
      MemberEJB (1 - M) MemberDialogCluster (M - 1) DialogCluster

      ---
      MemberEJB
      Set clusters (MemberDialogClusters)

      MemberDialogCluster
      MemberLocal member
      DialogClusterLocal dialogCluster
      Date timeCreated

      DialogCluster
      ---

      This is very much like an M-N relationship, but implemented as two 1-M relationships. All I want to do is get a list of the DialogClusters (directly) belonging to a particular member.

      My test to try and access the returned item looks like this:

      Set dialogClusters = ejbSelectDialogClustersInQueue(getMemberPk());
      for (Iterator i = dialogClusters.iterator(); i.hasNext(); )
      {
      System.out.println("Member - Return set type is: " + i.next().getClass().getName() );
      }

      If I try to cast the objects within the Set to DialogClusterLocal I get a classcastexception.

      I am missing something really simple, I know it, but I can't find out what. I have tried this on JBoss 3.0.0 alpha, and just recently on beta with no apparent change.

      Many thanks,

      Tim