[jboss-jira] [JBoss JIRA] Commented: (EJBTHREE-425) Exception when an entity persisted and removed in the same JTA

Carsten Christensen (JIRA) jira-events at lists.jboss.org
Mon Aug 20 03:38:01 EDT 2007


    [ http://jira.jboss.com/jira/browse/EJBTHREE-425?page=comments#action_12372898 ] 
            
Carsten Christensen commented on EJBTHREE-425:
----------------------------------------------

Hi, i still see this error, and none of the workarounds seems to work.

My Entity is in a inherritance heraki, where i have 

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class Element implements Serializable
{	
	
	@Id
	@GeneratedValue
	@Column(name = "elementId", unique = true, nullable = false)
	@NotNull
	private int elementId;
	
	@ManyToOne(optional=true)
	@JoinColumn(name="pageId", nullable=false)
	private Page page;
.....
}

@Entity
public class ExtElement extends Element {

	//, cascade=CascadeType.ALL
	@OneToMany(fetch = FetchType.EAGER, mappedBy="explainText")
	@MapKey(name="languageId")
	private Map<Integer,ExtElementLanguage> extElementLanguages;
....
}


when i do 

em.remove(em.merge(element));

i get the error:

09:18:56,332 FATAL [application] javax.ejb.EJBTransactionRolledbackException: deleted entity passed to persist: [my.package.Element#<null>]
javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: deleted entity passed to persist: [my.package.Element#<null>]
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
......

This is badly influencing customers, do you have any solution?

have tried to split the line to em.merge(element); em.remove.element()
toss in flush and clear() etc



> Exception when an entity persisted and removed in the same JTA
> --------------------------------------------------------------
>
>                 Key: EJBTHREE-425
>                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-425
>             Project: EJB 3.0
>          Issue Type: Bug
>         Environment: java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
>            Reporter: Jens Elkner
>
> JBoss/Hibernate throws an exception, if an entity is persisted and later removed in the same JTA, even when em.flush() has been called before removal.
> org.hibernate.ObjectDeletedException: deleted entity passed to persist ...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list