Please help, Orion seems to loose track of entities in the database
(exclusive-write-access="false").

I have a FlightEntity[1] <- SpotEntity[n] relationship defined.

Inside of FlightEntityBean.ejbRemove, I attempt to remove all the SpotEntity
objects by calling a home method on SpotEntityHome which inturn uses a
SpotEntityHome.findByFlight(FlightEntity f) to find all the spots for a
flight, and call remove on each one.

One of the SpotEntity objects cannot be deleted and calls
context.setRollbackOnly() before throwing a RemoveException.

If inside of FlightEntityBean.ejbRemove, I DO NOT catch the Exception, and
let it proceed to the client, the SpotEntity which threw the RemoveException
originally, remains in the database BUT is somehow lost from the Orion
Server (finder does not find it again).

On the other hand, if I catch the RemoveException from
FlightEntityBean.ejbRemove, and "ignore" the Spot remains associated
(correctly so) with the Flight, but the client does not get an exception.

What follows are TWO examples.  In the first, I let the exception get to the
client, in the second I ignore the exception by catching it in
FlightEntityBean.ejbRemove(). In each example, I execute a Test function
before and after the ejbRemove operation.  Test function simply finds the
Flight and iterates over the Spots in the flight.  The test function and
FlightEntityBean.ejbRemove execute in different transactions.

----------------------------------------------------------------------------
---------------------------------------------------------------------
EXAMPLE 1: The RemoveException WAS thrown to the client.

1. Test function is called from the client indicates that there is 1 spot in
the flight
2. Client is about to call ejbRemove on the Flight
3. RemoveException is thrown by one of the spots, and is printed by the
Client (GREAT!)
4. Test function called from the client indicates that there are 0 spots in
the flight  (WHY 0 spots?)

Sidenote: If the transaction was marked with setRollbackOnly(), why does the
lookup for spots does not find anything?  Looking at the database, the
flight and the spot ARE there.  Restarting Orion at this point, will find
the Spot AGAIN!!!!

5. Another attempt to delete the Flight is executed
6. This time, Orion thinks that there are 0 spots (but there IS a spot in
the database)
7. The flight is removed
8. This is confirmed by the test not being able to find the flight again

Orion/1.5.2 initialized
1) Test begin
This flight contains: 1 spots
Spot: 1345772 23
Test end
2) About to call deleteFlight
3) Got exception from delete flight: InvalidOperationException on spot
1345772, expected state(s): 0 1 2 , current state: 3
Begin trace:
javax.ejb.RemoveException: InvalidOperationException on spot 1345772,
expected state(s): 0 1 2 , current state: 3
        at
com.indnet.symbiosis.model.entity.spot.SpotEntityBean.ejbRemove(SpotEntityBe
an.java:53)
        at
SpotEntity_EntityBeanWrapper57.remove(SpotEntity_EntityBeanWrapper57.java:11
5)
        at
com.indnet.common.model.base.AbstractEntityBean.remove(AbstractEntityBean.ja
va:89)
        at
com.indnet.symbiosis.model.entity.spot.SpotEntityBean.ejbHomeRemoveByFlight(
SpotEntityBean.java:31)
        at
SpotEntityHome_EntityHomeWrapper749.removeByFlight(SpotEntityHome_EntityHome
Wrapper749.java:1123)
        at
com.indnet.symbiosis.model.entity.flight.FlightEntityBean.ejbRemove(FlightEn
tityBean.java:32)
        at
FlightEntity_EntityBeanWrapper56.remove(FlightEntity_EntityBeanWrapper56.jav
a:116)
        at
com.indnet.symbiosis.service.campaignmanagement.CampaignManagementServiceBea
n._deleteFlight(CampaignManagementServiceBean.java:220)
        at
com.indnet.symbiosis.service.campaignmanagement.CampaignManagementServiceBea
n.deleteFlight(CampaignManagementServiceBean.java:181)
        at
CampaignManagementService_StatelessSessionBeanWrapper20.deleteFlight(Campaig
nManagementService_StatelessSessionBeanWrapper20.java:1222)
        at
com.indnet.symbiosis.client.jsp.partner.pinpointer.pagegen.beans.FlightDelet
eBean.initialize(FlightDeleteBean.java:93)
        at com.slsideas.pagegen.beans.Bean.processRequest(Bean.java:106)
        at
com.slsideas.pagegen.tags.ProcessTag.doStartTagInherited(ProcessTag.java:79)
        at com.slsideas.pagegen.tags.BaseTag.doStartTag(BaseTag.java:153)
        at
__jspPage0_templates_partner_pinpointer_DeleteFlightProcess_jsp._jspService(
__jspPage0_templates_partner_pinpointer_DeleteFlightProcess_jsp.java:76)
        at com.orionserver.http.OrionHttpJspPage.service(Unknown Source)
        at com.evermind._ah._rad(Unknown Source)
        at com.evermind.server.http.JSPServlet.service(Unknown Source)
        at com.evermind._cxb._abe(Unknown Source)
        at com.evermind._cxb._uec(Unknown Source)
        at com.evermind._cxb.forward(Unknown Source)
        at
com.slsideas.pagegen.servlets.BaseControllerServlet.evalTemplate(BaseControl
lerServlet.java:330)
        at
com.slsideas.pagegen.servlets.TemplateControllerServlet.processRequest(Templ
ateControllerServlet.java:56)
        at
com.slsideas.pagegen.servlets.BaseControllerServlet.doGet(BaseControllerServ
let.java:263)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
        at com.evermind._cxb._abe(Unknown Source)
        at com.evermind._cxb._uec(Unknown Source)
        at com.evermind._io._twc(Unknown Source)
        at com.evermind._io._gc(Unknown Source)
        at com.evermind._if.run(Unknown Source)
End trace:
4) Test begin
This flight contains: 0 spots
Test end

5)

6) Test begin
This flight contains: 0 spots
Test end
About to call deleteFlight
7) Done with call deleteFlight
8) Test begin
Unable to find flight: No such entity:
com.indnet.common.model.base.EntityKey@1488eb id: 1345771
Test end


----------------------------------------------------------------------------
---------------------------------------------------------------------

EXAMPLE 2: The exception was "ignored" by Flight.ejbRemove

1. Test function indicates that there is 1 spot for this flight
2. Client attempts to call deleteFlight (ejbRemove)
3. Client does NOT get an exception, because we catch it in Flight.ejbRemove
4. Test function indicates that there is still 1 spot for this flight
5. Another attempt at a Flight ejbRemove
6. Same result, flight is not deleted, Spot remains.


Orion/1.5.2 initialized
1) Test begin
This flight contains: 1 spots
Spot: 1345775 2
Test end
2) About to call deleteFlight
3) Done with call deleteFlight
4) Test begin
This flight contains: 1 spots
Spot: 1345775 2
Test end
5) Test begin
This flight contains: 1 spots
Spot: 1345775 2
Test end
About to call deleteFlight
Done with call deleteFlight
6) Test begin
This flight contains: 1 spots
Spot: 1345775 2
Test end


----------------------------------------------------------------------------
---------------------------------------------------------------------

PLEA:  At this point I do not know what's going on.  The only variance
between these two cases is that in one case I let the exception escape to
the client, and in the other case I don't:

public class FlightEntityBean ...  {

  public void ejbRemove() throws RemoteException, RemoveException {
    //Remove all spots
    //
    try {
      SpotEntityHomeFinder.getHome().removeByFlight(getEntity());
    }
    catch (final RemoveException e) {
      //Ignore!!!
      //throw e;
    }
  }

I know this message is kinda long, and most people will not read it.  I am
only hoping that one of the Orion development folks will give it some
attention.

Thanks.
-AP_


Reply via email to