-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: ArrayIndexOutOfBoundsException
PostPosted: Tue Oct 21, 2003 12:08 pm 
Newbie

Joined: Sat Sep 06, 2003 8:49 pm
Posts: 8
Very simple mapping, 1 table. This was working up until yesterday, and I can't seem to make it work. I'm performing several updates in the scope of one transaction and all the sudden it starts barfing on me. Here is the associated debug:

AbstractHibernateDAO is mine, I have a method saveOrUpdateAll that does this:

protected void saveOrUpdateAll(List valueObjects)
throws HibernateException
{
_log.debug("saveOrUpdateAll size = " + valueObjects.size());

SessionFactory sessionFactory = getSessionFactory();

Transaction trans = null;
Session session = sessionFactory.openSession();

try
{
trans = session.beginTransaction();

for (java.util.Iterator it = valueObjects.iterator(); it.hasNext();)
{
ValueObject currentVO = (ValueObject)it.next();

if (!isValidValueObject(currentVO))
throw new HibernateException("Can not persist object of type " + currentVO.getClass().getName());

Object toPersist = getObjectToPersist(currentVO);

session.saveOrUpdate(toPersist);
}

trans.commit();
}
catch (HibernateException ex)
{
trans.rollback();
throw ex;
}
finally
{
session.close();
}
}

The getObjectToPersist method was a temp hack, right now it is returning whatever you send it.

The debug prints look correct except for the AIOOBE. Any help is GREATLY appreciated!
--m


2003-10-21 10:53:21,407 DEBUG [Thread-4] hibernate.AbstractHibernateDAO (AbstractHibernateDAO.java:202) - saveOrUpdateAll size = 3
2003-10-21 10:53:21,407 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:413) - opened session
2003-10-21 10:53:21,407 DEBUG [Thread-4] transaction.JDBCTransaction (JDBCTransaction.java:36) - begin
2003-10-21 10:53:21,457 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:1270) - updating [com.sun.ice.buildservices.model.BuildRequest#3]
2003-10-21 10:53:21,457 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:1270) - updating [com.sun.ice.buildservices.model.BuildRequest#1]
2003-10-21 10:53:21,457 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:1270) - updating [com.sun.ice.buildservices.model.BuildRequest#2]
2003-10-21 10:53:21,457 DEBUG [Thread-4] transaction.JDBCTransaction (JDBCTransaction.java:54) - commit
2003-10-21 10:53:21,457 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2011) - flushing session
2003-10-21 10:53:21,467 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2113) - Flushing entities and processing referenced collections
2003-10-21 10:53:21,467 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2209) - Updating entity: [com.sun.ice.buildservices.model.BuildRequest#3]
2003-10-21 10:53:21,477 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2209) - Updating entity: [com.sun.ice.buildservices.model.BuildRequest#1]
2003-10-21 10:53:21,487 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2209) - Updating entity: [com.sun.ice.buildservices.model.BuildRequest#2]
2003-10-21 10:53:21,487 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2397) - Processing unreferenced collections
2003-10-21 10:53:21,487 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2408) - Scheduling collection removes/(re)creates/updates
2003-10-21 10:53:21,497 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2023) - Flushed: 0 insertions, 3 updates, 0 deletions to 3 objects
2003-10-21 10:53:21,497 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2028) - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2003-10-21 10:53:21,497 DEBUG [Thread-4] impl.SessionImpl (SessionImpl.java:2058) - executing flush
2003-10-21 10:53:21,497 DEBUG [Thread-4] persister.EntityPersister (EntityPersister.java:617) - Updating entity: com.sun.ice.buildservices.model.BuildRequest#3
2003-10-21 10:53:21,507 DEBUG [Thread-4] impl.BatcherImpl (BatcherImpl.java:166) - about to open: 0 open PreparedStatements, 0 open ResultSets
2003-10-21 10:53:21,507 DEBUG [Thread-4] impl.SessionFactoryImpl (SessionFactoryImpl.java:526) - prepared statement get: update build_request set priority=?, application=?, requestor=?, engineer=?, request=?, comments=?, submitDate=?, requestByDate=?, startDate=?, doneDate=?, status=?, type=? where id=?
2003-10-21 10:53:21,507 DEBUG [Thread-4] impl.SessionFactoryImpl (SessionFactoryImpl.java:536) - preparing statement
2003-10-21 10:53:21,507 DEBUG [Thread-4] persister.EntityPersister (EntityPersister.java:366) - Dehydrating entity: com.sun.ice.buildservices.model.BuildRequest#3
2003-10-21 10:53:21,517 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '1' to parameter: 1
2003-10-21 10:53:21,517 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding 'Generic' to parameter: 2
2003-10-21 10:53:21,517 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '145663' to parameter: 3
2003-10-21 10:53:21,517 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 4
2003-10-21 10:53:21,527 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '21 October 2003 10:30:48' to parameter: 7
2003-10-21 10:53:21,527 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '21 October 2003 10:30:00' to parameter: 8
2003-10-21 10:53:21,537 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 9
2003-10-21 10:53:21,537 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 10
2003-10-21 10:53:21,547 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '0' to parameter: 11
2003-10-21 10:53:21,547 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '0' to parameter: 12
2003-10-21 10:53:21,547 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '3' to parameter: 13
2003-10-21 10:53:21,547 DEBUG [Thread-4] impl.BatchingBatcher (BatchingBatcher.java:24) - Adding to batch
2003-10-21 10:53:21,557 DEBUG [Thread-4] persister.EntityPersister (EntityPersister.java:617) - Updating entity: com.sun.ice.buildservices.model.BuildRequest#1
2003-10-21 10:53:21,557 DEBUG [Thread-4] persister.EntityPersister (EntityPersister.java:366) - Dehydrating entity: com.sun.ice.buildservices.model.BuildRequest#1
2003-10-21 10:53:21,557 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '2' to parameter: 1
2003-10-21 10:53:21,557 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding 'RAS Profile' to parameter: 2
2003-10-21 10:53:21,567 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '145663' to parameter: 3
2003-10-21 10:53:21,567 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 4
2003-10-21 10:53:21,587 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '21 October 2003 10:30:27' to parameter: 7
2003-10-21 10:53:21,587 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '21 October 2003 10:30:00' to parameter: 8
2003-10-21 10:53:21,587 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 9
2003-10-21 10:53:21,597 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 10
2003-10-21 10:53:21,597 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '0' to parameter: 11
2003-10-21 10:53:21,597 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '0' to parameter: 12
2003-10-21 10:53:21,607 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '1' to parameter: 13
2003-10-21 10:53:21,607 DEBUG [Thread-4] impl.BatchingBatcher (BatchingBatcher.java:24) - Adding to batch
2003-10-21 10:53:21,607 DEBUG [Thread-4] persister.EntityPersister (EntityPersister.java:617) - Updating entity: com.sun.ice.buildservices.model.BuildRequest#2
2003-10-21 10:53:21,607 DEBUG [Thread-4] persister.EntityPersister (EntityPersister.java:366) - Dehydrating entity: com.sun.ice.buildservices.model.BuildRequest#2
2003-10-21 10:53:21,617 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '3' to parameter: 1
2003-10-21 10:53:21,617 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding 'Generic' to parameter: 2
2003-10-21 10:53:21,617 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '145663' to parameter: 3
2003-10-21 10:53:21,617 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 4
2003-10-21 10:53:21,627 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '21 October 2003 10:30:35' to parameter: 7
2003-10-21 10:53:21,627 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '21 October 2003 10:30:00' to parameter: 8
2003-10-21 10:53:21,627 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 9
2003-10-21 10:53:21,637 DEBUG [Thread-4] type.NullableType (NullableType.java:38) - binding null to parameter: 10
2003-10-21 10:53:21,637 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '0' to parameter: 11
2003-10-21 10:53:21,637 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '0' to parameter: 12
2003-10-21 10:53:21,637 DEBUG [Thread-4] type.NullableType (NullableType.java:44) - binding '2' to parameter: 13
2003-10-21 10:53:21,647 DEBUG [Thread-4] impl.BatchingBatcher (BatchingBatcher.java:24) - Adding to batch
2003-10-21 10:53:21,657 DEBUG [Thread-4] impl.BatchingBatcher (BatchingBatcher.java:46) - Executing batch size: 3
2003-10-21 10:53:21,667 ERROR [Thread-4] impl.BatchingBatcher (BatchingBatcher.java:62) - Exception executing batch:
java.lang.ArrayIndexOutOfBoundsException: 2
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:53)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:105)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2103)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2062)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2005)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:57)
at com.sun.ice.hibernate.AbstractHibernateDAO.saveOrUpdateAll(AbstractHibernateDAO.java:228)
at com.sun.ice.hibernate.AbstractHibernateDAO.updateAll(AbstractHibernateDAO.java:331)
at com.sun.ice.buildservices.biz.PriorityManagerImpl.enforcePriority(PriorityManagerImpl.java:187)
at com.sun.ice.buildservices.biz.PriorityManagerImpl.reassignPriorities(PriorityManagerImpl.java:156)
at com.sun.ice.buildservices.biz.ReassignPrioritiesCommand.doExecute(ReassignPrioritiesCommand.java:62)
at com.sun.ice.buildservices.biz.AbstractCommand.execute(AbstractCommand.java:90)
at com.sun.ice.buildservices.web.BuildRequestAction.reassignPriorities(BuildRequestAction.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at com.sun.ice.buildservices.web.BaseAction.execute(BaseAction.java:55)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at com.sun.ice.buildservices.web.UserFilter.doFilter(UserFilter.java:135)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 21, 2003 12:13 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://forum.hibernate.org/viewtopic.ph ... sexception

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 21, 2003 12:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Looks like some problem with JDBC batch updates. Disable batching and see what happens.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 21, 2003 12:20 pm 
Newbie

Joined: Sat Sep 06, 2003 8:49 pm
Posts: 8
christian wrote:
http://forum.hibernate.org/viewtopic.php?t=924587&highlight=arrayindexoutofboundsexception


I looked at this before, but his mapping was much more complex and he just had duplicate mapped properties. My mapping is very simple 1 table, I am attempting to turn off batching and see what happens.

Thanks.

--m


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 21, 2003 12:23 pm 
Newbie

Joined: Sat Sep 06, 2003 8:49 pm
Posts: 8
gavin wrote:
Looks like some problem with JDBC batch updates. Disable batching and see what happens.


Excellent, set the batch size to 0 and it seems to be working now. Is that a JDBC driver issue? (I'm using Oracle's 9i JDBC driver).

Thanks!
--m


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 3:53 pm 
Newbie

Joined: Mon Oct 13, 2003 12:57 pm
Posts: 3
hi,
i had the same problem as Christian (i'm also working on Oracle 9i).
so i set the batch size to 0, as said Gavin, and it worked.


the issue is that i need to optimize my application. then, i need to use
batch size and set it to 20 or 30.

why setting batch size to a value higer than 1 causes an exception?
is this a bug in hibernate? if yes when do u expect to patch it?

thanks a lot


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.