Hi,

The Entity bean below uses Oracle sequence to set it primary key; on JBoss side it's "unknown-pk". When value object gets generated, XDoclet creates following PersonValue. However, it causes the problem: "java.io.NotSerializableException: java.lang.Object" since it uses Object for PK.
Is there any way to use getGenPK() method of Entity bean to generate just "get" method on Value Object? So, the idea is that I would like to expose getPK of type Long, but not setPK.


I'm using: XDoclet 1.2 and JBoss 3.2.1

Thanks a lot.



----------------------------
public class PersonValue
   extends java.lang.Object
   implements java.io.Serializable
{
   private java.lang.Long genPK;

}
   private java.lang.Object pk;

   public PersonValue()
   {
          pk = new java.lang.Object(); //PROBLEM
   }
   ...etc
}
-----------------------------

/**
* @ejb:bean
* name="Person"
* local-jndi-name="test.Person"
* type="CMP"
* view-type="local"
* transaction-type="Container"
* cmp-version="2.x"
* schema="Person"
*
* @ejb.finder
* signature="Collection findAll()"
* transaction-type="NotSupported"
* unchecked="true"
*
* @ejb:home generate="local" local-class="test.PersonHome"
* @ejb:interface generate="local" local-class="test.Person"
* @ejb:pk class="java.lang.Object"
* @jboss:table-name "PERSON"
* @jboss:create-table create="false"
* @jboss:remove-table remove="false"
* @jboss:tuned-updates "${jboss.tuned.updates}"
*
[EMAIL PROTECTED]
* class="java.lang.Long"
* readonly="true"
* field-name="id"
* column-name="person_id"
* jdbc-type="INTEGER"
* sql-type="INTEGER"
* auto-increment="true"
* @jboss.entity-command
* name="pk-sql"
* @jboss.entity-command-attribute
* name="pk-sql"
* value="SELECT PCM_RT_SEQ.nextval FROM DUAL"
*
* @ejb.value-object
* match="*"
* name="Person"
* @ejb.util generate="physical"
*/
abstract public class PersonBean extends BaseEntityBean implements EntityBean
{


        /**
         * @ejb:create-method
         */
        public java.lang.Object ejbCreate  () throws CreateException
        {
                return null;
        }

        public void ejbPostCreate ( ) throws CreateException
        {
        }

        /**
     *
     * @ejb.interface-method
     *   view-type="local"
     *
     */
     public java.lang.Long getGenPK()
    {
        return (Long) entityContext.getPrimaryKey();
     }
..}


------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to