Hi guys,
I have a really serious problem so any input from you is greatly appreciated. I am using as an application server
JBoss 3.0.0 and Oracle9i as a Database. Changing the app server is not possible.
I have a very long time consuming process which eventually ends with the exception:
11:03:51,921 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
java.lang.OutOfMemoryError
11:03:51,921 ERROR [STDERR] java.rmi.RemoteException: null; nested exception is:
java.lang.OutOfMemoryError
Embedded Exception
null; nested exception is:
java.lang.OutOfMemoryError
11:03:51,921 ERROR [STDERR] at it.deltadator.common.util.IdGenerator.getId(IdGenerator.java:33)
11:03:51,921 ERROR [STDERR] at t.deltadator.cdg.be.consuntivo.ejb.ses.ManagerCompetenziazioneBean.saveCompetenziazione(ManagerCompetenziazioneBean.java:146)
11:03:51,968 ERROR [STDERR] at it.deltadator.cdg.be.consuntivo.ejb.ses.ManagerCompetenziazioneBean.executeCompetenziazioneConsuntivo(ManagerCompetenziazioneBean.java:287)
.................
Let me explain you the usecase. I have two tables A and B. In table A there are two columns: DateStart and DateEnd. Let's assume I have a record in table A with DateStart= '1 January 2004' and DateEnd = '1 July 2004'. For each day occuring between these two dates, I have to create a record in table B. So using this example, I have to create around 180 records inside table B (31 for January, 29 for February,..., 30 for June, 1 for July).
The problem appears when I have hundreds of records inside table A. Imagine that for 1000 records inside table A with DateStart= '1 January 2004' and DateEnd = '1 July 2004' I have to create 180 * 1000 = 180.000 records inside table B!!!
I can see why JBoss runs out of memory. I have to tell you that for each record inside A is started and ended a transaction. So there is no global transaction.
I would like to hear from you some ideas about how to implement this usecase. Currently it's using Business Delegate + Session Bean + Entity Beans.
In my opinion it's better to put everything inside a Stored Procedure and just call that, but the client wants to see the progress (a progress bar with a message like "101st from 200 processed...")and that's why we are using this architecture.
As a temporary solution we've increased the memory allocated for the JVM but I want to find a better solution.
Thanks for all your suggestions.
Sergiu.