Post your code and jbosscmp-jdbc.xml.
Also the full error log.
Your relation defined as a one-one looks like a one-many.
The ClassCastException can occur if the result is a collection, not a single row.
Try to define your relation as a one-many, with a collection as return type of the getter.
do you have any document to implement a one-to-one relationships
I think the @ejb.relation is good in both case (2 beans) but I can't understand why I can't call one bean to other by getDocidMetaData() method.
thanks in advance
Your relation is a good one.
I tell you the problem can occurs if the result of the query (managed by the container for the relationship) is a multi-row instead of a single row.
Do you have potentially many EDocMetaData for one EDocuments ?
In this case, your relation MUST BE a one-many.
With the informations you give, this is the only problem I think about.
I ask you to post your code and the whole descriptors, not only a snippet.
But you cannot set a one-one relationship if it is a many-one in reality.
Seems more clear ?
But in my case both tables contain the same amount of row
And the data model for those tables is one-to-one relationships
I don't know very much about CMR, I'm learning that now. But I think the ClassCastException could possibly come from these lines:
Collection col = myBean.getAllDocumentByCategoryId(11);
EDocuments element = ((EDocuments) iter.next());
Unless you can guaruntee that every item in the collection returned by getAllDocumentsByCategoryId is of type Edocuments, or can be cast to type Edocuments.