1 Reply Latest reply on Nov 27, 2002 10:56 AM by Stefan Heckler

    relation problem

    Stefan Heckler Novice

      I am using JBoss 3.0.0.

      Defining a relation using the following

      *
      * @ejb:relation
      * name="PRI-ROL-FK"
      * role-name="ROL-has-PRIN"
      * cascade-delete="yes"
      * target-role-name="PRIN-has-ROLES"
      * target-ejb="Principals"
      * target-multiple="yes"
      *
      * @jboss:relation-mapping style="foreign-key"
      *
      * @jboss:relation
      * fk-constraint="true"
      * fk-column="PRINCIPALID_FK"
      * related-pk-field="principalId"
      *
      * */
      public abstract String getPrincipalId_FK();
      public abstract void setPrincipalId_FK(String id);

      the relation is created in the database correctly, but I get a runtime error accessing the setter/getter for the foreign key field ->

      18:28:53,089 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
      java.lang.ClassCastException: $Proxy98
      at de.psi.cmd.ejb.usecase.anmeldung.data.Roles$Proxy.getPrincipalId_FK()
      at de.psi.cmd.ejb.usecase.anmeldung.data.Roles.getRoleVO(Roles.java:159)

      What is wrong with my source code /deployment description??

      Thanks

      Stefan Heckler

        • 1. CMR 1:n Xdoclet Sample
          Stefan Heckler Novice

          Help!!
          I need some sample source code for CMR 1:n relation deployment with XDoclet. I spent lots of time to figure it out, but it still does not work.

          Here is my code in the "one" entity, which results in the following error on deployment: "Mappings were not provided for all fields: unmaped fields=...."


          /**
          *
          * @ejb:relation
          * name="Role-Users"
          * role-name="Role-has-Users"
          * target-role-name="User-belongs-to-Role"
          * target-ejb="Principals"
          * target-multiple="no"
          *
          * @jboss:relation-mapping style="foreign-key"
          *
          *
          * @jboss:relation fk-constraint="true"
          * @jboss:target-relation
          * related-pk-field="principalId"
          * fk-column="PRINCIPAL_FK"
          */
          public abstract Set getPrincipalsforRole();
          public abstract void setPrincipalsforRole(Set principals);

          in the "many" Entity I just wrote
          "
          public abstract RolesLocal getRole();
          public abstract void setRoles(RolesLocal role);
          "

          Can someone help me?
          Stefan Heckler