[jboss-user] [EJB 3.0] - javax.transaction.RollbackException
mravikrish
do-not-reply at jboss.com
Tue Feb 10 08:04:56 EST 2009
Hello,
I am ramu i am getting following exception while deleting project object.
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected 1
And My piece of code is
skillids ,bidIds are 2 ArrayLists
Project deleteProject = manager.find(Project.class, projectId);
BuyerRating buyerRating=deleteProject.getBuyerRating();
VendorRating vendorRating =deleteProject.getVendorRating();
if(buyerRating!=null)
{
Query deleteBuyerRatingQuery = manager.createQuery("delete from BuyerRating br where br.project_Id = :id ");
deleteBuyerRatingQuery.setParameter("id",buyerRating.getProject_Id() );
deleteBuyerRatingQuery.executeUpdate();
manager.flush();
}
if(vendorRating!=null)
{
Query deleteVendorRatingQuery = manager.createQuery("delete from VendorRating vr where vr.project_Id = :id1 ");
deleteVendorRatingQuery.setParameter("id1",vendorRating.getProject_Id() );
deleteVendorRatingQuery.executeUpdate();
manager.flush();
}
for(int i :bidIds )
{
Bid child = manager.getReference (Bid.class,i );
Vendor vendor = child.getVendors();
vendor.getBids().remove(child);
Project listParents = child.getProject();
listParents.getBids().remove(child);
manager.remove(child);
manager.flush();
}
for(int j:skillIds )
{
Skill s = manager.getReference(Skill.class, j);
s.getProjects().remove(deleteProject);
deleteProject.getSkills().remove(s);
manager.flush();
}
Project project = manager.merge(deleteProject);
manager.remove(project);
please tell me where i am doing mistake.
Thanks
KRamu
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4208539#4208539
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4208539
More information about the jboss-user
mailing list