-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: javax.persistence.EntityNotFoundException
PostPosted: Fri Nov 20, 2009 10:48 am 
Newbie

Joined: Fri Nov 20, 2009 10:41 am
Posts: 3
Hi, I have a OneToMay relationship in my project, and when I try to remove the side that holds the collection this exception arise:
javax.persistence.EntityNotFoundException: deleted entity passed to persist: [org.desoft.dcp.ag.entity.Block#<null>]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:598)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:513)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)

This is my code:
The first class has this code for the relation:

@OneToMany(mappedBy="block",fetch=FetchType.EAGER,cascade=CascadeType.ALL)
public Set<Field> getFields() {
return fields;
}

And the second:
@ManyToOne(optional = false)
@JoinColumns({
@JoinColumn(name = "enterprise_id", referencedColumnName = "enterprise_id", insertable = false, updatable = false),
@JoinColumn(name = "block_id", referencedColumnName = "block_id", insertable = false, updatable = false)
})
public Block getBlock() {
return block;
}


Top
 Profile  
 
 Post subject: Re: javax.persistence.EntityNotFoundException
PostPosted: Fri Nov 20, 2009 2:01 pm 
Newbie

Joined: Fri Nov 20, 2009 10:41 am
Posts: 3
working around this I have the idea of remove the entity through a query...this is my code:
String query="delete from Block block where block.blockPK.blockId='"+blockPk.getBlockId()+" ' and block.blockPK.enterpriseId=' "+ blockPk.getEnterpriseId()+" ' ";
application.getDataService().executeQuery(query, 1);

BlockPk represents my primary key...the problem now is this exception:

Caused by: javax.ejb.EJBException: java.lang.IllegalStateException: org.hibernate.hql.QueryExecutionRequestException: Not supported for DML operations [delete from org.desoft.dcp.ag.entity.Block block where block.blockPK.blockId='h' and block.blockPK.enterpriseId='cea']
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

could anyone help me ,please!!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.