One line looks suspect to me, though I don't know if it's the source of your trouble.

> @ejb:table-name       User

The correct tag is

    @ejb:persistence table-name="User"

At least that's what I'm using.

David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756


> -----Original Message-----
> From: [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 30, 2003 11:45 PM
> To: [EMAIL PROTECTED]
> Subject: [Xdoclet-user] [problem] one-one cmr bidirection
> 
> 
> hi, i'm new to xdoclet and currently learning how to
> compose cmr thru xdoclet.
> however, there's a problem occurred. it issues "CMP
> field for key not found".
> the env contains j2sdk1.4.1_01,
> jboss3.0.4-tomcat4.1.12, xdoclet-1.2b3.
> the source is as A):
> build file is as B):
> i appreciate any suggestions, sincerely.
> thank you very much.
> 
> =====A)======
> package test.auth;
> 
> import javax.ejb.*;
> import javax.naming.*;
> import java.util.*;
> import test.domain.*;
> 
> /**
>  *
>  * @ejb:bean  type="CMP"
>  *            cmp-version="2.x"
>  *            name="User"
>  *            jndi.name="cmr.User"
>  *            view-type="local"
>  * @ejb:home  generate="local"        
>  *            local-class="test.domain.UserLocalHome"
>  * @ejb:interface     
>  *            generate="local"
>  *            local-class="test.domain.UserLocal"
>  * @ejb:table-name    User
>  * @ejb:finder
>  *            signature="Collection findAll()"
>  *            unchecked="true"
>  *            query="select distinct Object(user) from User
> user"
>  *            result-type-mapping="Local"
>  * @ejb:pk
>  */
> public abstract class UserBean implements EntityBean{
>       /**
>        * @ejb:create-method
>        */
>       public UserPK ejbCreate(String email, String
> password) 
>                       throws CreateException{
>               setEmail(email);
>               setPassword(password);
>               return new UserPK(email);
>       }
>       public void ejbPostCreate(String email, String
> password) 
>                       throws CreateException{ }
>       /**
>        * @ejb:pk-field
>        * @ejb:persistent-field
>        * @jboss:column-name EMAIL
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract String getEmail();
>       /**
>        * @ejb:persistent-field        view-type="local"
>        */
>       public abstract void setEmail(String email);
>       /**
>        * @ejb:persistent-field
>        * @jboss:column-name PASSWORD
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract String getPassword();
>       /**
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract void setPassword(String passwrod);
> 
>       /**
>        * @ejb:interface-method        view-type="local"
>        * @ejb:transaction     type="Required"
>        * @ejb:relation        
>        *      name="UserHasUserInfo"
>        *      role-name="UserHasUserInfo"
>        *      target-role-name="UserInofContainedByUser"
>        * @jboss:relation
>        *      fk-column="EMAIL"
>        *      related-pk-field="EMAIL"
>        */
>       public abstract test.domain.UserInfoLocal
> getUserInfo();
>       /**
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract void
> setUserInfo(test.domain.UserInfoLocal userInfo);
> 
>       public void setEntityContext(EntityContext
> context){ }
>       public void unsetEntityContext(){ }
>       public void ejbRemove() throws
> javax.ejb.RemoveException{ }
>       public void ejbLoad(){ }
>       public void ejbStore(){ }
>       public void ejbPassivate(){ }
>       public void ejbActivate(){ }
> 
>       
> }
> 
> ------------
> package test.auth;
> 
> import javax.ejb.*;
> import javax.naming.*;
> import test.domain.*;
> 
> /**
>  * @ejb:bean  type="CMP"
>  *            cmp-version="2.x"
>  *            name="UserInfo"
>  *            jndi.name="cmr.UserInfo"
>  *            view-type="local"
>  * @ejb:home  generate="local"        
>  *            local-class="test.domain.UserInfoLocalHome"
>  * @ejb:interface     generate="local"
>  *                    local-class="test.domain.UserInfoLocal"
>  * @jboss:table-name  UserInfo
>  * @ejb:finder        signature="test.domain.UserInfoLocal
> findByEmail(java.lang.String email)"
>  *            unchecked="true"
>  *            query="select distinct object(userinfo) from
> UserInfo userinfo where userinfo.email = ?1"
>  *            result-type-mapping="Local"
>  * @ejb.pk
>  */
> public abstract class UserInfoBean implements
> EntityBean{
>       /**
>        * @ejb:create-method
>        */
>       public UserInfoPK ejbCreate(String name, String
> email, String dept,
>                               String phone, boolean isEmployee) 
>                       throws CreateException{
>               setName(name);
>               setEmail(email);
>               setDept(dept);
>               setPhone(phone);
>               setEmployee(isEmployee);
>               return new UserInfoPK(email);
>       }
> 
>       public void ejbPostCreate(String name, String email,
> String dept,
>                               String phone, boolean isEmployee) 
>                       throws CreateException{ }
>       /**
>        * @ejb:pk-field
>        * @ejb:persistent-field
>        * @jboss:column-field
>        * ejb:interface-method         view-type="local"
>        */
>       public abstract String getEmail();
>       /**
>        * @ejb:persistent-field        view-type="local"
>        */
>       public abstract void setEmail(String value);
> 
>       /**
>        * @ejb:persistent-field
>        * @jboss:column-name   NAME
>        * @ejb:interface-metod view-type="local"
>        */
>       public abstract String getName();
>       /**
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract void setName(String name);
> 
>       /**
>        * @ejb:persistent-field
>        * @jboss:column-name   DEPARTMENT
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract String getDept();
>       /**
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract void setDept(String dept);
> 
>       /**
>        * @ejb:persistent-field        
>        * @jboss:column-name   PHONE
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract String getPhone();
>       /**
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract void setPhone(String phone);
> 
>       /**
>        * @ejb:persistent-field
>        * @jboss:column-name   EMPLOYEE
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract boolean getEmployee();
>       /**
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract void setEmployee(boolean isEmployee);
>       /**
>        * @ejb:interface-method        view-type="local"
>        * @ejb:transaction     type="Required"
>        * @ejb:relation
>        *      name="UserHasUserInfo"
>        *      role-name="UserInfoContainedByUser"
>        *      target-role-name="UserHasUserInfo"
>        *      cascade-delete="yes"
>        */
>       public abstract test.domain.UserLocal getUser();
>       /**
>        * @ejb:interface-method        view-type="local"
>        */
>       public abstract void setUser(test.domain.UserLocal
> user);
> 
>       public void setEntityContext(EntityContext
> context){ }
>       public void unsetEntityContext(){ }
>       public void ejbRemove() throws
> javax.ejb.RemoveException { }
>       public void ejbLoad(){ }
>       public void ejbStore(){ }
>     public void ejbPassivate(){ }
> }
> 
> =======B)====
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <project name="jboss02" default="generate"
> basedir=".">
> 
>       <property name="xdoclet-home"
> value="C:/xdoclet-bin-1.2b3"/>
>       <property name="jboss.home" 
> value="c:/jboss-3.0.4_tomcat-4.1.12"/>
>       <property name="deploy.dir" 
> value="${jboss.home}/server/default/deploy"/>
>       
>       <property name="dest.dir" value="target"/>
>       <property name="jar.name" value="cmr-ejb.jar"/>
> 
>       <path id="class.path">
>               <fileset dir="${xdoclet-home}/lib">
>                       <include name="*.jar"/>
>               </fileset>
>               <fileset
> dir="${jboss.home}/server/default/lib">
>                       <include name="*.jar"/>
>               </fileset>
>       </path>
> 
>       <target name="clear">
>               <delete dir="target"/>
>       </target>
> 
>       <target name="init">
>               <taskdef name="ejbdoclet"
>                       classname="xdoclet.modules.ejb.EjbDocletTask"
>                       classpathref="class.path"/>
>       </target>
> 
>       <target name="prepare" depends="init">
>               <mkdir dir="${dest.dir}/classes"/>
>               <mkdir dir="${dest.dir}/src"/>
>               <mkdir dir="${dest.dir}/meta-inf"/>
>       </target>
> 
>       <target name="generate" depends="prepare">
> 
>               <ejbdoclet
>                   destdir="${dest.dir}/src"
>                   excludedtags="@version,@author,@todo"
>                   ejbspec="2.0"
>               >
> 
>                       <packageSubstitution packages="auth" 
>                               substituteWith="domain"
>                       />      
>                       <fileset dir="src">
>                           <include name="**/*Bean.java"/>
>                       </fileset>
>                       <!--
>                       <session/>
>                       -->
>                       <entitycmp/>
>                       <localinterface/>
>                       <remoteinterface/>
>                       <localhomeinterface/>   
>                       <homeinterface/>
>                       <entitypk/>
>                       <deploymentdescriptor
>                           destdir="${dest.dir}/meta-inf" 
>                       />
>       
>                       <jboss
>                           version="3.0"
>                           destdir="${dest.dir}/meta-inf"
>                       />
>               
>               </ejbdoclet>
>         <javac
>             destdir="${dest.dir}/classes"
>             classpathref="class.path"
>             debug="on"
>             deprecation="on"
>             optimize="off"
>             >
> 
>             <src path="src"/>
>             <src path="${dest.dir}/src"/>
>         </javac>
> 
>       </target>
>       
> 
>       <target name="package">
>               <zip destfile="${basedir}/${jar.name}">
>                       <zipfileset dir="${dest.dir}/classes" 
> includes="**/*.class"/>
>                       <zipfileset dir="${dest.dir}/META-INF"
> prefix="META-INF/"/>
>               </zip>
>       </target>
> 
>       <target name="deploy" depends="package">
>               <copy file="${basedir}/${jar.name}"
> todir="${deploy.dir}"/>
>       </target>
> 
>       <target name="undeploy">
>               <delete file="${deploy.dir}/${jar.name}"/>
>       </target>
> 
>       <target name="clean">
>               <delete dir="target"/>
>       </target>
> </project>
> 
>               
> 
> 
> 
> -----------------------------------------------------------------
> 每天都 Yahoo!奇摩
> 海的?色、?的?息、?你的?度,?在信?底?
http://tw.promo.yahoo.com/mail_premium/stationery.html


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's Free Linux 
Tutorials.  Learn everything from the bash shell to sys admin. Click now! 
http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to