Please help me, what's wrong with these code? Very thanks.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   x_by
Posted On:   Friday, December 13, 2002 06:17 AM

I wrote a simple cmp ejb, there are there beans in it. studentBean, courseBean, specialtyBean, the relationship beween them: (studentBean:courseBean)=(m:n) (studentBean:specialtyBean)=(n:1) It can be compiled, but cann't be deploied, when deploying it, many exception occured, main exception are: org.jboss.deployment.DeploymentException: Entity: ejb/school/course not found for: org.jboss.metadata.RelationshipRoleMetaData@4d40df [ObjectName: jboss.j2ee:jndiName=ejb/school/course,service=EJB state: FAILED I Depend On: Depends On Me: org.jboss.deployment.DeploymentException: Entity: ejb/school/course not found for: org.jboss.metadata.R   More>>

I wrote a simple cmp ejb, there are there beans in it. studentBean, courseBean, specialtyBean, the relationship beween them:

(studentBean:courseBean)=(m:n)

(studentBean:specialtyBean)=(n:1)

It can be compiled, but cann't be deploied, when deploying it, many exception occured, main exception are:



org.jboss.deployment.DeploymentException: Entity: ejb/school/course not found for: org.jboss.metadata.RelationshipRoleMetaData@4d40df


[ObjectName: jboss.j2ee:jndiName=ejb/school/course,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Entity: ejb/school/course not found for: org.jboss.metadata.RelationshipRoleMetaData@4d40df,


ObjectName: jboss.j2ee:jndiName=ejb/school/student,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Entity: ejb/school/cou
rse not found for: org.jboss.metadata.RelationshipRoleMetaData@4d40df,


ObjectNam
e: jboss.j2ee:jndiName=ejb/school/specialty,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Entity: ejb/school/cou
rse not found for: org.jboss.metadata.RelationshipRoleMetaData@4d40df]
following is my code:




studentBean

			
import....

/**
* @ejb:bean
* name="school/student"
* display="studentEJB"
* type="CMP"
* jndi-name="ejb/school/student"
* local-jndi-name="ejb/school/studentLocal"
* view-type="both"
*
* @jboss:table-name table-name="student"
* @jboss:create-table create="true"
* @jboss:remove-table remove="true"
**/
public abstract class studentBean implements EntityBean
{
private EntityContext context;

/**
* @ejb:persistent-field
* @ejb:pk-field
* @jboss:column-name name="id"
**/
public abstract String getId();
public abstract void setId(String id);

/**
* @ejb:persistent-field
* @jboss:column-name name="name"
**/
public abstract String getName();
public abstract void setName(String name);

/**
* @ejb:persistent-field
* @jboss:column-name name="age"
**/
public abstract int getAge();
public abstract void setAge(int age);

/**
* @ejb:persistent-field
* @jboss:column-name name="sex"
**/
public abstract String getSex();
public abstract void setSex(String sex);

/**
* @ejb:relation
* name="student-specialty-1-n"
* role-name="student"
* target-multiple="yes"
* @jboss:relation
* related-pk-field="id"
* fk-column="specialty_id"
**/
public abstract specialtyLocal getSpecialty();
public abstract void setSpecialty(specialtyLocal specialty);

/**
* @ejb:relation
* name="student-course-m-n"
* role-name="student"
* target-multiple="yes"
* target-ejb="ejb/school/course"
*
* @jboss:relation-mapping style="relation-table"
* @jboss:relation-table table-name="student_course"
* @jboss:relation
* relation-pk-field="id"
* fk-column="student_id"
* @jboss:target-relation
* relation-pk-field="id"
* fk-column="course_id"
**/
public abstract Collection getCourses();
public abstract void setCourses(Collection courses);

....


courseBean
			
import ...
/**
* @ejb:bean
* name="school/course"
* display="courseEJB"
* type="CMP"
* jndi-name="ejb/school/course"
* local-jndi-name="ejb/school/courseLocal"
* view-type="both"
*
* @jboss:table-name table-name="course"
* @jboss:create-table create="true"
* @jboss:remove-table remove="true"
**/
public abstract class courseBean implements EntityBean
{
private EntityContext context;

/**
* @ejb:persistent-field
* @ejb:pk-field
* @jboss:column-name name="id"
**/
public abstract String getId();
public abstract void setId(String id);

/**
* @ejb:persistent-field
* @jboss:column-name name="name"
**/
public abstract String getName();
public abstract void setName(String name);

/**
* @ejb:relation
* name="course-student-n-m"
* role-name="course"
* target-multiple="yes"
* target-ejb="ejb/school/student"
*
* @jboss:relation-mapping style="relation-table"
* @jboss:relation-table table-name="student_course"
* @jboss:relation
* relation-pk-field="id"
* fk-column="course_id"
* @jboss:target-relation
* relation-pk-field="id"
* fk-column="student_id"
**/
public abstract Collection getStudents();
public abstract void setStudents(Collection students);

....


specialtyBean
			
import ...
/**
* @ejb:bean
* name="school/specialty"
* display="specialtyEJB"
* type="CMP"
* jndi-name="ejb/school/specialty"
* local-jndi-name="ejb/school/specialtyLocal"
* view-type="both"
*
* @jboss:table-name table-name="specialty"
* @jboss:create-table create="true"
* @jboss:remove-table remove="true"
**/
public abstract class specialtyBean implements EntityBean
{
private EntityContext context;

/**
* @ejb:persistent-field
* @ejb:pk-field
* @jboss:column-name name="id"
**/
public abstract String getId();
public abstract void setId(String id);

/**
* @ejb:persistent-field
* @jboss:column-name name="name"
**/
public abstract String getName();
public abstract void setName(String name);

/**
* @ejb:relation
* name="student-specialty-1-n"
* role-name="specialty"
* @jboss:relation
* related-pk-field="id"
* fk-column="specialty_id"
**/
public abstract Collection getStudents();
public abstract void setStudents(Collection students);

...

   <<Less

Re: Please help me, what's wrong with these code? Very thanks.

Posted By:   Michael_Hopf  
Posted On:   Sunday, January 5, 2003 08:57 AM

Hi,

the target-ejb tag refers to the ejbs name and not the

jndi-name. Leave out the "ejb/". It should look like this:



target-ejb="school/student"



Also see our cmr cmp xdoclet jboss examle at

http://www.software-friends.com/know_how/index.htm



Regards, Michael
About | Sitemap | Contact