From: Alexey L. <al...@jb...> - 2003-06-26 16:34:24
|
Please, provide a stacktrace for javax.ejb.EJBException: Data contains multiple values, but this cmr field is single valued And also make sure you are not assigning Collection to a single valued CMR field and the query loading the CMR field returns only one row. alex Thursday, June 26, 2003, 5:56:58 PM, Jason Calabrese wrote: JC> Alexey, JC> Thanks for the suggestion, but it didn't solve the problem. JC> Any other ideas? JC> Jason JC> On Wednesday 25 June 2003 11:19 pm, Alexey Loubyansky wrote: >> 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 |