Hi,

I have modified template example , created  user entity bean. some how it
creating wrong package name.

user entity class, it generating  wrong package name.
com.percipia.auth.entity, but it suppose to be com.percipia.auth.interfaces.

generated line:
   public com.percipia.auth.entity.UserEntityData getValueObject(  ) throws
java.rmi.RemoteException;

--------------------------------

UserEntityBean.java
---------------

package com.percipia.auth.entity;

import com.percipia.auth.interfaces.*;

import java.sql.Date;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Iterator;

import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.FinderException;
import javax.ejb.RemoveException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

/**
 * The Entity bean represents a UserEntity
 *
 * @author Andreas Schaefer
 * @version $Revision: 1.1 $
 *
 * @ejb:bean name="User/UserEntity"
 *           display-name="UserEntity working on projects to support
clients"
 *           type="CMP"
 *           jndi-name="ejb/User/UserEntity"
 *
 * @ejb:transaction type="Required"
 *
 * @ejb:data-object extends="com.percipia.auth.interfaces.AbstractData"
 *                  setdata="false"
 *
 * @ejb:finder signature="java.util.Collection findAll()"
 *
 * @ejb:finder signature="com.percipia.auth.interfaces.UserEntity
findByName( java.lang.String pSurname, java.lang.String pLastName )"
 *
 * @jboss:finder-query name="findByName"
 *                     query="First_Name = {0} AND Last_Name = {1}"
 *
 * @ejb:finder signature="com.percipia.auth.interfaces.UserEntity
findAnotherByName( int pId, java.lang.String pSurname, java.lang.String
pLastName )"
 *
 * @jboss:finder-query name="findAnotherByName"
 *                     query="Id != {0} AND First_Name = {1} AND Last_Name =
{2}"
 *
 * @jboss:table-name table-name="UserEntity"
 *
 * @jboss:create-table create="true"
 *
 * @jboss:remove-table remove="true"
 **/
public abstract class UserEntityBean
   implements EntityBean
{




// -------------------------------------------------------------------------
   // Members



// -------------------------------------------------------------------------

   public EntityContext mContext;




// -------------------------------------------------------------------------
   // Methods



// -------------------------------------------------------------------------

   /**
   * Store the data within the provided data object into this bean.
   *
   * @param pUserEntity The Value Object containing the UserEntity values
   *
   * @ejb:interface-method view-type="remote"
   **/
   public void setValueObject( UserEntityData pUserEntity )
      throws
         InvalidValueException
   {
      // Check for Data Integrity in the Value Object
      if( pUserEntity == null ) {
         throw new InvalidValueException( "object.undefined",
"UserEntity" );
      }
      if( pUserEntity.getId() <= 0 ) {
         throw new InvalidValueException( "id.invalid", new String[] {
"UserEntity", "Id" } );
      }
      // Check if the UserEntity is not already saved
      try {
         UserEntityHome lHome = (UserEntityHome) mContext.getEJBHome();
         UserEntity lEntity = lHome.findAnotherByName( pUserEntity.getId(),
pUserEntity.getFirstName(), pUserEntity.getLastName() );
         // UserEntity with the given email address already exists retrieve
instead of create a new one
         throw new InvalidValueException( "user.already.exists", new
String[] { pUserEntity.getFirstName() + " " + pUserEntity.getLastName() } );
      }
      catch( FinderException fe ) {
         // That's ok
      }
      catch( RemoteException re ) {
         // Should never happens (are local)
      }
      try {
         UserEntityHome lHome = (UserEntityHome) mContext.getEJBHome();
         UserEntity lUserEntity = lHome.findByName(
pUserEntity.getFirstName(), pUserEntity.getLastName() );
         if( lUserEntity.getValueObject().getId() != pUserEntity.getId() ) {
         }
      }
      catch( FinderException fe ) {
         // That's ok
      }
      catch( RemoteException re ) {
         // Should never happens (are local)
      }
      setId( pUserEntity.getId() );
      setFirstName( pUserEntity.getFirstName() );
      setLastName( pUserEntity.getLastName() );
      setPassword( pUserEntity.getPassword() );
      setEmail( pUserEntity.getEmail() );
      setAddress( pUserEntity.getAddress() );
      setCity( pUserEntity.getCity() );
      setZIP( pUserEntity.getZIP() );
      setState( pUserEntity.getState() );
      setCountry( pUserEntity.getCountry() );
      if( getCreationDate() == null ) {
         // Only set it if object is created
         setCreationDate( new Date( new java.util.Date().getTime() ) );
      }
      // After making any chances update the modification date
      setModificationDate( new Date( new java.util.Date().getTime() ) );
   }

   /**
   * Create and return a UserEntity data object populated with the data from
   * this bean.
   *
   * @return Returns a UserEntity value object containing the data within
this
   *  bean.
   *
   * @ejb:interface-method view-type="remote"
   **/
   public UserEntityData getValueObject() {
      UserEntityData lData = new UserEntityData();

      lData.setId( getId() );
      lData.setFirstName( getFirstName() );
      lData.setLastName( getLastName() );
      lData.setPassword( getPassword() );
      lData.setEmail( getEmail() );
      lData.setAddress( getAddress() );
      lData.setCity( getCity() );
      lData.setZIP( getZIP() );
      lData.setState( getState() );
      lData.setCountry( getCountry() );
      lData.setCreationDate( getCreationDate() );
      lData.setModificationDate( getModificationDate() );

      return lData;
   }

   /**
   * Describes the instance and its content for debugging purpose
   *
   * @return Debugging information about the instance and its content
   **/
   public String toString() {
      return "UserEntityBean [ " + getValueObject() + " ]";
   }


   /**
   * Retrive a unique creation id to use for this bean.  This will end up
   * demarcating this bean from others when it is stored as a record
   * in the database.
   *
   * @return Returns an integer that can be used as a unique creation id.
   *
   * @throws ServiceUnavailableException Indicating that it was not possible
   *                                     to retrieve a new unqiue ID because
   *                                     the service is not available
   **/
   private int generateUniqueId()
      throws ServiceUnavailableException
   {

      int lUniqueId = -1;
      /*
      try {
         Context lContext = new InitialContext();

         String lSequenceName = (String) lContext.lookup(
            "java:comp/env/SequenceName"
         );
         SequenceGeneratorHome lHome = (SequenceGeneratorHome)
PortableRemoteObject.narrow(
            lContext.lookup(
               "java:comp/env/ejb/User/SequenceGenerator"
            ),
            SequenceGeneratorHome.class
         );
         SequenceGenerator lBean = (SequenceGenerator) lHome.create();
         lUniqueId = lBean.getNextNumber( lSequenceName );
         lBean.remove();
      }
      catch ( NamingException ne ) {
         throw new ServiceUnavailableException( "Naming lookup failure: " +
ne.getMessage() );
      }
      catch ( CreateException ce ) {
         throw new ServiceUnavailableException( "Failure while creating a
generator session bean: " + ce.getMessage() );
      }
      catch ( RemoveException re ) {
         // When the Bean cannot be removed after a while it will be taken
back by the container
         // therefore ignore this exception
      }
      catch ( RemoteException rte ) {
         throw new ServiceUnavailableException( "Remote exception occured
while accessing generator session bean: " +  rte.getMessage() );
      }
      */
      return lUniqueId;
   }




// -------------------------------------------------------------------------
   // Properties (Getters/Setters)



// -------------------------------------------------------------------------

   /**
   * Retrieve the UserEntity's id.
   *
   * @return Returns an int representing the id of this UserEntity.
   *
   * @ejb:persistent-field
   * @ejb:pk-field
   *
   * @jboss:column-name name="Id"
   **/
   public abstract int getId();

   /**
   * Set the UserEntity's id.
   *
   * @param pId The id of this UserEntity. Is set at creation time.
   **/
   public abstract void setId( int pId );

   /**
   * Retrieve the UserEntity's FirstName.
   *
   * @return Returns an int representing the FirstName of this UserEntity.
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="First_Name"
   **/
   public abstract String getFirstName();

   /**
   * Set the UserEntity's FirstName.
   *
   * @param pFirstName The FirstName of this UserEntity.  Is set at creation
time.
   **/
   public abstract void setFirstName( String pFirstName );

   /**
   * Retrieve the UserEntity's LastName.
   *
   * @return Returns an int representing the LastName of this UserEntity.
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="Last_Name"
   **/
   public abstract String getLastName();

   /**
   * Set the UserEntity's LastName.
   *
   * @param pLastName The LastName of this UserEntity.  Is set at creation
time.
   **/
   public abstract void setLastName( String pLastName );

   /**
   * Retrieve the UserEntity's Password.
   *
   * @return Returns an int representing the Password of this UserEntity.
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="Password"
   **/
   public abstract String getPassword();

   /**
   * Set the UserEntity's Password.
   *
   * @param pPassword The Password of this UserEntity
   **/
   public abstract void setPassword( String pPassword );

   /**
   * Retrieve the UserEntity's Email.
   *
   * @return Returns an int representing the Email of this UserEntity.
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="Email"
   **/
   public abstract String getEmail();

   /**
   * Set the UserEntity's Email.
   *
   * @param pEmail The Email of this UserEntity.  Is set at creation time.
   **/
   public abstract void setEmail( String pEmail );

   /**
   * @return Returns the Address of this UserEntity
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="Address"
   **/
   public abstract String getAddress();

   /**
   * Specify the Address of this UserEntity
   *
   * @param pAddress Address of this UserEntity
   **/
   public abstract void setAddress( String pAddress );

   /**
   * @return Returns the City of this UserEntity
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="City"
   **/
   public abstract String getCity();

   /**
   * Specify the City of this UserEntity
   *
   * @param pCity City of this UserEntity
   **/
   public abstract void setCity( String pCity );

   /**
   * @return Returns the ZIP of this UserEntity
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="ZIP"
   **/
   public abstract String getZIP();

   /**
   * Specify the ZIP of this UserEntity
   *
   * @param pZIP ZIP of this UserEntity
   **/
   public abstract void setZIP( String pZIP );

   /**
   * @return Returns the State of this UserEntity
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="State"
   **/
   public abstract String getState();

   /**
   * Specify the State of this UserEntity
   *
   * @param pState State of this UserEntity
   **/
   public abstract void setState( String pState );

   /**
   * @return Returns the Country of this UserEntity
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="Country"
   **/
   public abstract String getCountry();

   /**
   * Specify the Country of this UserEntity
   *
   * @param pCountry Country of this UserEntity
   **/
   public abstract void setCountry( String pCountry );

   /**
   * @return Returns the creation date of this UserEntity
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="Creation_Date"
   **/
   public abstract Date getCreationDate();

   /**
   * Specify the creation date of this UserEntity
   *
   * @param pCreationDate Date of the creation of this UserEntity
   **/
   public abstract void setCreationDate( Date pCreationDate );

   /**
   * @return Returns the modification date of this UserEntity
   *
   * @ejb:persistent-field
   *
   * @jboss:column-name name="Modification_Date"
   **/
   public abstract Date getModificationDate();

   /**
   * Specify the modification date of this UserEntity
   *
   * @param pModificationDate Date of the modification of this UserEntity
   **/
   public abstract void setModificationDate( Date pModificationDate );




// -------------------------------------------------------------------------
   // Framework Callbacks



// -------------------------------------------------------------------------

   /**
   * Create a UserEntity based on the supplied UserEntity Value Object.
   *
   * @param pUserEntity The data used to create the UserEntity.
   *
   * @throws InvalidValueException If one of the values are not correct,
   *                               this will not roll back the transaction
   *                               because the caller has the chance to
   *                               fix the problem and try again
   * @throws EJBException If no new unique ID could be retrieved this will
   *                      rollback the transaction because there is no
   *                      hope to try again
   * @throws CreateException Because we have to do so (EJB spec.)
   *
   * @ejb:create-method view-type="remote"
   **/
   public UserEntityPK ejbCreate( UserEntityData pUserEntity )
      throws
         InvalidValueException,
         EJBException,
         CreateException
   {
      // Clone the given Value Object to keep changed private
      UserEntityData lData = (UserEntityData) pUserEntity.clone();
      try {
         // Each title must have a unique id to identify itself within the
DB
         lData.setId( generateUniqueId() );
      }
      catch( ServiceUnavailableException se ) {
         // The unique id could not be set therefore terminate the
transaction
         // by throwing a system exception
         throw new EJBException( se.getMessage() );
      }
      // Save the new UserEntity
      setValueObject( lData );
      // This is only possible in CMPs. Otherwise return a valid PK.
      return null;
   }

   public void ejbPostCreate( UserEntityData pUserEntity )
   {
   }

   public void setEntityContext( EntityContext lContext )
   {
      mContext = lContext;
   }

   public void unsetEntityContext()
   {
      mContext = null;
   }

   public void ejbActivate()
   {
   }

   public void ejbPassivate()
   {
   }

   public void ejbLoad()
   {
   }

   public void ejbStore()
   {
   }

   public void ejbRemove()
      throws
         RemoveException
   {
   }
}
--------------

I got the following error message.

xdoclet-generate:
[ejbdoclet] Generating Javadoc
[ejbdoclet] Javadoc execution
[ejbdoclet] Loading source file
C:\work\jboss\group\src\main\ejb\com\percipia\au
th\entity\UserEntityBean.java...
[ejbdoclet] Constructing Javadoc information...
[ejbdoclet] javadoc: warning - Cannot find class
com.percipia.auth.entity.UserEn
tityData
[ejbdoclet] javadoc: warning - Cannot find class
com.percipia.auth.entity.UserEn
tityPK
[ejbdoclet] Running <homeInterface/>
[ejbdoclet]   Generating Home interface for
'com.percipia.auth.entity.UserEntity
Bean'.
[ejbdoclet] Running <remoteInterface/>
[ejbdoclet]   Generating Remote interface for
'com.percipia.auth.entity.UserEnti
tyBean'.
[ejbdoclet] Running <entitypk/>
[ejbdoclet]   Generating PK class for
'com.percipia.auth.entity.UserEntityBean'.

[ejbdoclet] Running <dataobject/>
[ejbdoclet]   Generating Data Object class for
'com.percipia.auth.entity.UserEnt
ityBean'.
[ejbdoclet] Running <entitycmp/>
[ejbdoclet]   Generating CMP class for
'com.percipia.auth.entity.UserEntityBean'
.
[ejbdoclet] Running <deploymentDescriptor/>
[ejbdoclet]   Generating EJB deployment descriptor.
[ejbdoclet] Running <jboss/>
[ejbdoclet]   Generating jboss.xml.
[ejbdoclet]   Generating jaws.xml.
[ejbdoclet]   Generating jbosscmp-jdbc.xml.
[ejbdoclet] 2 warnings
compile:
    [mkdir] Created dir: C:\work\jboss\group\build\classes
    [javac] Compiling 9 source files to C:\work\jboss\group\build\classes
    [javac]
C:\work\jboss\group\build\generate\com\percipia\auth\interfaces\UserEntityHo
me.java:47: cannot resolve symbol
    [javac] symbol  : class UserEntityData
    [javac] location: package entity
    [javac]    public com.percipia.auth.interfaces.UserEntity
create(com.percipi
a.auth.entity.UserEntityData pUserEntity) throws
com.percipia.auth.interfaces.In
validValueException, javax.ejb.EJBException,
java.rmi.RemoteException,javax.ejb.
CreateException;
    [javac]
             ^
    [javac]
C:\work\jboss\group\build\generate\com\percipia\auth\interfaces\User
Entity.java:38: cannot resolve symbol
    [javac] symbol  : class UserEntityData
    [javac] location: package entity
    [javac]    public com.percipia.auth.entity.UserEntityData
getValueObject(  )
 throws java.rmi.RemoteException;
    [javac]                                   ^
    [javac]
C:\work\jboss\group\build\generate\com\percipia\auth\interfaces\User
Entity.java:44: cannot resolve symbol
    [javac] symbol  : class UserEntityData
    [javac] location: package entity
    [javac]    public void setValueObject(
com.percipia.auth.entity.UserEntityDa
ta pUserEntity ) throws com.percipia.auth.interfaces.InvalidValueException,
java
.rmi.RemoteException;
    [javac]                                                        ^
    [javac] 3 errors

BUILD FAILED

C:\work\jboss\group\build.xml:183: Compile failed, messages should have been
pro
vided.

Total time: 9 seconds

------------------


generate UserEntityHome.java class

/*
 * Generated file - Do not edit!
 */
package com.percipia.auth.interfaces;

import java.lang.*;
import com.percipia.auth.interfaces.*;
import java.sql.Date;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Iterator;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.FinderException;
import javax.ejb.RemoveException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

/**
 * Remote interface for User/UserEntity.
 * @author XDOCLET 1.1.2
 * @version XDOCLET 1.1.2
 * @xdoclet-generated at Jun 23, 2002 5:16:20 PM
 */
public interface UserEntity
   extends javax.ejb.EJBObject
{
   /**
    * Create and return a UserEntity data object populated with the data
from
    * this bean.
    * @return Returns a UserEntity value object containing the data within
this
  bean.
    */
   public com.percipia.auth.entity.UserEntityData getValueObject(  ) throws
java.rmi.RemoteException;

   /**
    * Store the data within the provided data object into this bean.
    * @param pUserEntity The Value Object containing the UserEntity values
    */
   public void setValueObject( com.percipia.auth.entity.UserEntityData
pUserEntity ) throws com.percipia.auth.interfaces.InvalidValueException,
java.rmi.RemoteException;

}

any idea, what i am doing wrong.

-SR



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to