Hello Jason,

try to remove cascade-delete for one-to-one. By the spec, it is
allowed only for many side.

alex

Thursday, June 26, 2003, 8:33:08 AM, Jason Calabrese wrote:

JC> I'm having a weird CMR problem with 3.2.0.

JC> I have a bean that a has 2 CMR fields that both target the same bean with 
JC> different pk's.

JC> One of the CMR fields is a 1:1 relation and the other is the single side of a 
JC> 1:M relation.

JC> The CMR fields can be read fine, but cause problems for ejbCreate.

JC> This is the error I get:
JC> 2003-06-25 18:35:16,563 ERROR [org.jboss.ejb.plugins.LogInterceptor] 
JC> TransactionRolledbackLocalException, causedBy:
JC> javax.ejb.EJBException: Data contains multiple values, but this cmr field is 
JC> single valued
JC> ...
JC> 2003-06-25 18:35:16,597 ERROR [org.jboss.ejb.plugins.LogInterceptor] 
JC> TransactionRolledbackLocalException, causedBy:
JC> javax.ejb.EJBException: null; CausedByException is:
JC>         A CMR collection may only be used within the transction in which it 
JC> ...

JC> If I get rid of the 1:1 CMR field (valueClass) the problem goes away. Here's 
JC> some of the code:
JC> ...
JC>         /** 
JC>          *  @ejb.relation
JC>          *              name="class-has-properties"
JC>          *              role-name="property-role"
JC>          *              cascade-delete="true"
JC>          *  @jboss.relation
JC>          *      fk-column="class_id"
JC>          *      related-pk-field="id"
JC>          *  @ejb:interface-method
JC>          */
JC>         public abstract ContentClassLocal getContentClass();

JC>         public abstract void setContentClass(ContentClassLocal contentClass);

JC>         /** 
JC>          *  @ejb.persistent-field
JC>          *  @ejb:interface-method
JC>          *  @jboss.column-name name="class_id"
JC>          */
JC>         public abstract String getContentClassId();

JC>         /** 
JC>          *  @ejb:interface-method
JC>          */
JC>         public abstract void setContentClassId(String classId);
JC> ...
JC>         /** 
JC>          *  @ejb.relation
JC>          *              name="object-has-valueClass"
JC>          *              role-name="object-role"
JC>          *              target-ejb="ContentClass"
JC>          *              target-role-name="class-role"
JC>          *              cascade-delete="true"
JC>          *  @jboss.relation
JC>          *      fk-column="value_class_id"
JC>          *      related-pk-field="id"
JC>          *  @ejb:interface-method
JC>          */
JC>         public abstract ContentClassLocal getValueClass();

JC>         public abstract void setValueClass(ContentClassLocal valueClass);

JC>         /** 
JC>          *  @ejb.persistence
JC>          *  @ejb:interface-method
JC>          *  @jboss.column-name name="value_class_id"
JC>          */
JC>         public abstract String getValueClassId();

JC>         /** 
JC>          *  @ejb:interface-method
JC>          */
JC>         public abstract void setValueClassId(String dataClassId);

JC> Any ideas?  If you need more code or more of the stack trace let me know.

JC> Thanks,

JC> Jason



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to