aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Problem with Transaction Timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problem with Transaction Timeout" Watch "Problem with Transaction Timeout" New topic
Author

Problem with Transaction Timeout

ravi inguva
Ranch Hand

Joined: Feb 07, 2002
Posts: 34
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


Sun Certified Java2 Programmer
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Why aren't you using Cascading delete in the EJB deployment descriptor?
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
ravi inguva
Ranch Hand

Joined: Feb 07, 2002
Posts: 34
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

Joined: Aug 10, 2001
Posts: 3892
    
    5
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

Joined: Feb 07, 2002
Posts: 34
Thanks Kyle for your optimum solution
-Ravi
 
 
subject: Problem with Transaction Timeout