Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Transaction Timeout

 
ravi inguva
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends
i facing a peculiar problem,
i am having CMR with one to many cardinality
here is the piece of code
Collection stackZonePKs = _zoneService.findPKsByParent(rowZone);
System.out.println("YardConfigurationServiceBean 4:: RowID"+aRowId);

for (Iterator i = stackZonePKs.iterator(); i.hasNext()
{
Zone stackZone = _zoneService.findById(((BigDecimal) i.next()).toString());
System.out.println("YardConfigurationServiceBean 6:: RowID"+stackZone.getName());
stackZone.remove();
}
in the code what i am doing is i am deleting all the child node or rows in the table getting the collections of primarykeys to remove the main node
what is happening is the transaction is getting timed out before deleting all the child nodes and the transaction is getting rolled back as a result of it can u please suggest me how t rectify this problem
i am using weblogic 7.0
Thanks in advnace
Ravi.I
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why aren't you using Cascading delete in the EJB deployment descriptor?
Kyle
 
ravi inguva
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh sorry i missed a point actually it is many - many relation not one to many
and the ejb-jar documentation says as follows
<!--
The cascade-delete element specifies that, within a particular
relationship, the lifetime of one or more entity beans is dependent
upon the lifetime of another entity bean. The cascade-delete element
can only be specified for an ejb-relationship-role element contained
in an ejb-relation element in which the other ejb-relationship-role
element specifies a multiplicity of One.
Used in: ejb-relationship-role
-->
<!ELEMENT cascade-delete EMPTY>
--------------------------------------------------
now how should i go about this
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yeah, the fact that it's many-to-many does make a difference.
I'd either rachet up your transaction timeout or (probably a better solution) handle the deletes outside of the Entity beans with a more optimized SQL statement you call from a Session bean (which we had to do a lot in EJB 1.1. prior to the introduction of CMR).
Kyle
 
ravi inguva
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kyle for your optimum solution
-Ravi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic