[jboss-user] javax.persistence.EntityNotFoundException: deleted entity passed to persist

Laura Barroso Perez laura.barroso at hab.desoft.cu
Fri Nov 20 13:07:32 EST 2009


working around this exception(avax.persistence.EntityNotFoundException:
deleted entity passed to persist) 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:10
2)

could anyone help me ,please!!!!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20091120/3a3adf48/attachment.html 


More information about the jboss-user mailing list