*
The moose likes BEA/Weblogic and the fly likes CMR problem in weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "CMR problem in weblogic" Watch "CMR problem in weblogic" New topic
Author

CMR problem in weblogic

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi all!
I'm trying to develop a management app with Weblogic using EJB2.0. I
created some CM relations (many-to-many, many-to-one, etc.) with no
problems, but there is a one that gets the next problem at deployment time:
Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error
was:
In relationship 'Servicios-Contratados', role
'Servicios-de-un-contrato', invalid column 'nombre', a column-map element
contains an invalid key-column.The key-column is not defined in the related
bean or it's not recognized because of case mismatch.
In relationship 'Servicios-Contratados', role
'Contratos-que-usan-el-servicio', invalid column 'id', a column-map element
contains an invalid key-column. The key-column is not defined in the related
bean or it's not recognized because of case mismatch.
This is the ejb-jar.xml (a snippet):
<entity>
<display-name></display-name>
<ejb-name>ContratoBean</ejb-name>
<local-home>es.upm.dit.gestionabonados.ContratoLocalHome</local-home>
<local>es.upm.dit.gestionabonados.ContratoLocal</local>
<ejb-class>es.upm.dit.gestionabonados.ContratoBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Contrato</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>numeroCuenta</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<entity>
<display-name></display-name>
<ejb-name>ServicioBean</ejb-name>
<local-home>es.upm.dit.gestionabonados.ServicioLocalHome</local-home>
<local>es.upm.dit.gestionabonados.ServicioLocal</local>
<ejb-class>es.upm.dit.gestionabonados.ServicioBean</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>Servicio</abstract-schema-name>
<cmp-field>
<field-name>nombre</field-name>
</cmp-field>
<cmp-field>
<field-name>url</field-name>
</cmp-field>
<cmp-field>
<field-name>precio</field-name>
</cmp-field>
<cmp-field>
<field-name>descripcion</field-name>
</cmp-field>
<primkey-field>nombre</primkey-field>
<query>
<query-method>
<method-name>findAllServicios</method-name>
<method-params/>
</query-method>
<ejb-ql>SELECT OBJECT(s) FROM Servicio s</ejb-ql>
</query>
</entity>
...
<ejb-relation>
<ejb-relation-name>Servicios-Contratados</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Servicios-de-un-contrato</ejb-relationship-role-
name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>ContratoBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>servicios</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Contratos-que-usan-el-servicio</ejb-relationship
-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>ServicioBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>contratos</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
...
and this is the weblogic-cmp-rdbms-jar.xml
...
<weblogic-rdbms-bean>
<ejb-name>ContratoBean</ejb-name>
<data-source-name>jdbc/es/upm/dit/gestionabonados/DataSource</data-source-na
me>
<table-name>Contrato</table-name>
<field-map>
<cmp-field>id</cmp-field>
<dbms-column>id</dbms-column>
</field-map>
<field-map>
<cmp-field>numeroCuenta</cmp-field>
<dbms-column>numerocuenta</dbms-column>
</field-map>
</weblogic-rdbms-bean>
<weblogic-rdbms-bean>
<ejb-name>ServicioBean</ejb-name>
<data-source-name>jdbc/es/upm/dit/gestionabonados/DataSource</data-source-na
me>
<table-name>Servicio</table-name>
<field-map>
<cmp-field>nombre</cmp-field>
<dbms-column>nombre</dbms-column>
</field-map>
<field-map>
<cmp-field>url</cmp-field>
<dbms-column>url</dbms-column>
</field-map>
<field-map>
<cmp-field>precio</cmp-field>
<dbms-column>precio</dbms-column>
</field-map>
<field-map>
<cmp-field>descripcion</cmp-field>
<dbms-column>descripcion</dbms-column>
</field-map>
</weblogic-rdbms-bean>
...
<weblogic-rdbms-relation>
<relation-name>Servicios-Contratados</relation-name>
<table-name>suscripcion</table-name>
<weblogic-relationship-role>
<relationship-role-name>Servicios-de-un-contrato</relationship-role-name>
<column-map>
<foreign-key-column>servicio</foreign-key-column>
<key-column>nombre</key-column>
</column-map>
</weblogic-relationship-role>
<weblogic-relationship-role>
<relationship-role-name>Contratos-que-usan-el-servicio</relationship-role-na
me>
<column-map>
<foreign-key-column>contrato</foreign-key-column>
<key-column>id</key-column>
</column-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
...
I cann't find where is the problem, because this code is equals to the
other which work. Anybody could help me?
Thank in advance.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Moving to Weblogic forum...


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,
(After a quick look on a rush today)
Hi as looks to me that this is a many-to-many relationship try to add the tags:
relationship-role-map
foreign-key-table
primary-key-table
under the weblogic-relationship-role tag to make the connection between the two tables, this should solve the problem.
regards,
Marcos Maia
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Do you know any site where i can find an example of complete weblogic-cmp-rdbms-jar.xml file? I have been trying to find one which i could follow, but i couldn't. So i do not know where to place these tags.
Thanks for your last reply.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I forget to say i am using weblogic 6.1. The information i found about the tags appears for weblogic 7.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CMR problem in weblogic
 
Similar Threads
CMR problem in weblogic
a cmr-field and a cmp-field on the bean are using the same name. The names
EJB QL RETURNING ONLY THE FIRST RECORD OF THE TABLE
Problem with jndi and data source
Need help with understanding the link between jndi and data source