Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB relations first time Q

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi after having a single bean running on my JBOSS server am up for the relationship ehem..
am having a Pagina bean with a collection of BlokTekst beans
when i deploy i got following err:
MBeanException: org.jboss.deployment.DeploymentException: Atleast one role of a foreign-key mapped relationship must have key fields (or <primkey-field> is missing from ejb-jar.xml): ejb-relation-name=BloksRel

here is my ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar >

<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>

<enterprise-beans>

<!-- Session Beans -->
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->

<!-- Entity Beans -->
<entity >
<description><![CDATA[Pagina EJB]]></description>
<display-name>Pagina</display-name>

<ejb-name>Pagina</ejb-name>

<home>sven.ent.interfaces.PaginaHome</home>
<remote>sven.ent.interfaces.Pagina</remote>
<local-home>sven.ent.interfaces.PaginaLocalHome</local-home>
<local>sven.ent.interfaces.PaginaLocal</local>

<ejb-class>sven.ent.ejb.PaginaCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Pagina</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>id</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>titel</field-name>
</cmp-field>
<primkey-field>id</primkey-field>

<!-- Write a file named ejb-finders-Pagina.xml if you want to define extra finders. -->
</entity>

<entity >
<description><![CDATA[BlokTekst EJB]]></description>
<display-name>BlokTekst</display-name>

<ejb-name>BlokTekst</ejb-name>

<home>sven.ent.interfaces.BlokTekstHome</home>
<remote>sven.ent.interfaces.BlokTekst</remote>
<local-home>sven.ent.interfaces.BlokTekstLocalHome</local-home>
<local>sven.ent.interfaces.BlokTekstLocal</local>

<ejb-class>sven.ent.ejb.BlokTekstCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>BlokTekst</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>id</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>tekst</field-name>
</cmp-field>
<primkey-field>id</primkey-field>

<!-- Write a file named ejb-finders-BlokTekst.xml if you want to define extra finders. -->
</entity>

<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->

<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->

</enterprise-beans>

<!-- Relationships -->
<relationships >
<ejb-relation >
<ejb-relation-name>BloksRel</ejb-relation-name>

<ejb-relationship-role >
<ejb-relationship-role-name>geefPagina</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>BlokTekst</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>pagina</cmr-field-name>
</cmr-field>
</ejb-relationship-role>

<ejb-relationship-role >
<ejb-relationship-role-name>ZijnErBlokken</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>Pagina</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>bloks</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>

</ejb-relation>
</relationships>

<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->

<!-- finder permissions -->

<!-- finder permissions -->

<!-- transactions -->

<!-- finder transactions -->
</assembly-descriptor>

</ejb-jar>


thank you for your time

Sven

ooops... can someone move me to JBOSS? thanx
[ August 31, 2004: Message edited by: Sven Sven ]
 
Whatever. Here's a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic