Hi all,

I'm trying to set up my VO's so that each entity has a normal and a light VO,
with all normal VO's containing composes of light values of the related VO.
So for classes A and B in a bidirectional 1:n CMR relationship, I'd like
there to be a AValue that with a composed BLightValue, and a BValue with a
composed ALightValue.

I've spent about the last 9 hours trying to muddle this together with no
luck, including digging in the sources trying to see if there was a bug that
I could find, but I'm stumped.  What I have below is about the closest I can
get, but in the generated CMP bean never generates the CMR VO setters within
setAValue() (it generates looking the same as the 'light' version...)

Can anyone identify something I'm doing wrong here?  I don't see any hi-prio
bugs that fit this description, so I presume I am doing something wrong.
I've attached a couple of sample classes and the CMP output of one of them.
In the CMP output, you can see that the getters is properly generated (light
getter doesn't modify bean relations), but the setter is exactly the same.

Thanks for any insights you can lend.  I'm really having a tough time
figuring out the VOTagsHandler code right now...

-b

******************************

/**
 * @ejb:bean name="User" type="CMP" jndi-name="ejb/bill2/gsumc/User"
primkey-field="id"
 *
 * @ejb:value-object name="UserFull" match="normal"
 * @ejb:value-object name="UserLight" match="light"
 */
public abstract class UserBean implements EntityBean {

    /**
     * @return Collection
     *
     * @ejb:interface-method
     * @ejb:relation
     *    name="user-group"
     *    role-name="many-userBeans-have-one-group"
     * @jboss:relation  related-pk-field="id"
     *                  fk-column="group_id"
     * @jboss:relation-table    table-name="user_group_rel"
     *                                                  create-table="true"
     *                                                  remove-table="false"
     * @ejb:value-object
compose="com.bill2.gsumc.ejb.beans.entity.GroupLightValue"
     *    compose-name="Group"
     *    members="com.bill2.gsumc.ejb.beans.entity.GroupLocal"
     *    members-name="GroupLightValue"
     *    relation="external"
     *    type="java.util.Collection"
     *    match="normal"
     */
    public abstract Collection getGroup();

    /**
     * @ejb:interface-method
     */
    public abstract void setGroup(Collection group);
...
}

******************

/**
 * @ejb:bean name="Group" type="CMP" jndi-name="ejb/bill2/gsumc/Group"
primkey-field="id"
 *
 * @ejb:value-object name="GroupFull" match="normal"
 * @ejb:value-object name="GroupLight" match="light"
 *
 */
public abstract class GroupBean implements EntityBean {
    /**
     * @return Collection
     *
     * @ejb:interface-method
     * @ejb:relation
     *    name="user-group"
     *    role-name="one-groupBean-has-many-users"
     * @jboss:relation         related-pk-field="id"
     *                         fk-column="user_id"
     * @jboss:relation-table    table-name="user_group_rel"
     *                                                  create-table="true"
     *                                                  remove-table="false"
     * @ejb:value-object
compose="com.bill2.gsumc.ejb.beans.entity.UserLightValue"
     *    compose-name="User"
     *    members="com.bill2.gsumc.ejb.beans.entity.UserLocal"
     *    members-name="UserLightValue"
     *    relation="external"
     *    type="java.util.Collection"
     *    match="normal"
     */
    public abstract Collection getUsers();

    /**
     * @ejb:interface-method
     */
    public abstract void setUsers(Collection users);
...
}

***********************
public abstract class UserCMP
   extends com.bill2.gsumc.ejb.beans.entity.UserBean
   implements javax.ejb.EntityBean
{

...

 /* Value Objects BEGIN */

   private com.bill2.gsumc.ejb.beans.entity.UserFullValue UserFullValue =
null;

   public com.bill2.gsumc.ejb.beans.entity.UserFullValue getUserFullValue()
   {
      UserFullValue = new com.bill2.gsumc.ejb.beans.entity.UserFullValue();
      try
         {
            UserFullValue.setName( getName() );
            UserFullValue.setEmail( getEmail() );
            UserFullValue.setUsername( getUsername() );
            UserFullValue.setPassword( getPassword() );
            UserFullValue.setTelephone( getTelephone() );
            UserFullValue.setSecretQuestion( getSecretQuestion() );
            UserFullValue.setSecretAnswer( getSecretAnswer() );
            UserFullValue.setId( getId() );
            UserFullValue.clearLogs();
            java.util.Iterator iLog = getLogs().iterator();
            while (iLog.hasNext()){
                UserFullValue.addLog(
((com.bill2.gsumc.ejb.beans.entity.LogLocal)iLog.next()).getLogLightValue()
);
            }
            UserFullValue.cleanLog();
            UserFullValue.clearPermissions();
            java.util.Iterator iPermission = getPermissions().iterator();
            while (iPermission.hasNext()){
                UserFullValue.addPermission(
((com.bill2.gsumc.ejb.beans.entity.PermissionLocal)iPermission.next()).getPer
missionLightValue() );
            }
            UserFullValue.cleanPermission();
            UserFullValue.clearGroups();
            java.util.Iterator iGroup = getGroup().iterator();
            while (iGroup.hasNext()){
                UserFullValue.addGroup(
((com.bill2.gsumc.ejb.beans.entity.GroupLocal)iGroup.next()).getGroupLightVal
ue() );
            }
            UserFullValue.cleanGroup();
            UserFullValue.clearScheduledMessages();
            java.util.Iterator iScheduledMessage =
getScheduledMessages().iterator();
            while (iScheduledMessage.hasNext()){
                UserFullValue.addScheduledMessage(
((com.bill2.gsumc.ejb.beans.entity.ScheduledMessageLocal)iScheduledMessage.ne
xt()).getScheduledMessageLightValue() );
            }
            UserFullValue.cleanScheduledMessage();

         }
         catch (Exception e)
         {
            throw new javax.ejb.EJBException(e);
         }

          return UserFullValue;
   }
   private com.bill2.gsumc.ejb.beans.entity.UserLightValue UserLightValue =
null;

   public com.bill2.gsumc.ejb.beans.entity.UserLightValue getUserLightValue()
   {
      UserLightValue = new com.bill2.gsumc.ejb.beans.entity.UserLightValue();
      try
         {
            UserLightValue.setName( getName() );
            UserLightValue.setEmail( getEmail() );
            UserLightValue.setUsername( getUsername() );
            UserLightValue.setPassword( getPassword() );
            UserLightValue.setTelephone( getTelephone() );
            UserLightValue.setSecretQuestion( getSecretQuestion() );
            UserLightValue.setSecretAnswer( getSecretAnswer() );
            UserLightValue.setId( getId() );

         }
         catch (Exception e)
         {
            throw new javax.ejb.EJBException(e);
         }

          return UserLightValue;
   }

   public void setUserFullValue(
com.bill2.gsumc.ejb.beans.entity.UserFullValue valueHolder )
   {

          try
          {
                 setName( valueHolder.getName() );
                 setEmail( valueHolder.getEmail() );
                 setUsername( valueHolder.getUsername() );
                 setPassword( valueHolder.getPassword() );
                 setTelephone( valueHolder.getTelephone() );
                 setSecretQuestion( valueHolder.getSecretQuestion() );
                 setSecretAnswer( valueHolder.getSecretAnswer() );

          }
          catch (Exception e)
          {
                 throw new javax.ejb.EJBException(e);
          }
   }
   public void setUserLightValue(
com.bill2.gsumc.ejb.beans.entity.UserLightValue valueHolder )
   {

          try
          {
                 setName( valueHolder.getName() );
                 setEmail( valueHolder.getEmail() );
                 setUsername( valueHolder.getUsername() );
                 setPassword( valueHolder.getPassword() );
                 setTelephone( valueHolder.getTelephone() );
                 setSecretQuestion( valueHolder.getSecretQuestion() );
                 setSecretAnswer( valueHolder.getSecretAnswer() );

          }
          catch (Exception e)
          {
                 throw new javax.ejb.EJBException(e);
          }
   }

/* Value Objects END */

...

}


-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to