-->
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.  [ 3 posts ] 
Author Message
 Post subject: ArrayIndexOutOfBoundsException on trying to save a transient
PostPosted: Mon Feb 06, 2006 6:19 pm 
Newbie

Joined: Mon Feb 06, 2006 5:14 pm
Posts: 3
I've just set up my first little test program using the Event 'getting started' example as a reference. I'm scratching my head over a ArrayIndexOutOfBoundsException exception that is being thrown upon save.

I did find an earlier topic on this issue, but that seemed to involve a column that had been mapped multiple times and doesn't seem to apply here.

Environment: Win XP, Hibernate 3, JDK 1.5

The relevant mapping:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

   <class name="beans.TitleBean" table="bddb_titles_hib">
      <id name="id" column="id">
         <generator class="native"/>
      </id>
      <property name="name" length="255" column="title_name"/>
      <property name="category" length="31" column="title_categfory"/>
      <property name="format" length="15" column="title_format"/>
      <property name="transfer" length="15" column="title_transfer"/>
      <property name="binder" column="title_binder"/>
      <property name="page" column="title_page"/>
      <property name="slot" column="title_slot"/>
      <property name="pending" column="title_pending"/>
   </class>

</hibernate-mapping>



The exception (with what I feel to be the relevant debug logging):

Code:
DEBUG - Inserting entity: [beans.TitleBean#1]
DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG - insert into bddb_titles_hib (title_name, title_categfory, title_format, title_transfer, title_binder, title_page, title_slot, title_pending, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into bddb_titles_hib (title_name, title_categfory, title_format, title_transfer, title_binder, title_page, title_slot, title_pending, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
DEBUG - preparing statement
DEBUG - Dehydrating entity: [beans.TitleBean#1]
DEBUG - binding 'The Matrix' to parameter: 1
DEBUG - binding 'Movie' to parameter: 2
DEBUG - binding 'DVD-VIDEO' to parameter: 3
DEBUG - binding 'Digital' to parameter: 4
DEBUG - binding '1' to parameter: 5
DEBUG - binding '1' to parameter: 6
DEBUG - binding '1' to parameter: 7
DEBUG - binding 'false' to parameter: 8
DEBUG - binding '1' to parameter: 9
DEBUG - Adding to batch
DEBUG - Executing batch size: 1
ERROR - Exception executing batch:
java.lang.ArrayIndexOutOfBoundsException: 1
   at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:143)
   at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:65)
   at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:451)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:281)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:179)
   at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:165)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:80)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
   at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
   at Main.createAndStoreTitle(Main.java:53)
   at Main.main(Main.java:26)
   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:585)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG - closing statement



And the calling code:
Code:
        session.beginTransaction();
        Title title = new TitleBean();
        title.setName( "The Matrix" );
        title.setCategory( "Movie" );
        title.setFormat( "DVD-VIDEO" );
        title.setTransfer( "Digital" );
        title.setBinder( (short)1 );
        title.setPage( (short)1 );
        title.setSlot( (short)1 );
        title.setPending( false );
        session.save( title );
        session.getTransaction().commit();



Is there something incredibly stupid that I'm doing? An obvious step that I missed?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 12:23 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
i think i've come accross this issue . i think for me it was of postgres driver problem , plz try with a diffrerent driver

_________________
sHeRiN
thanks for your ratings ...... :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 1:20 pm 
Newbie

Joined: Mon Feb 06, 2006 5:14 pm
Posts: 3
That was it zzyborg! Thanks.

I got really confused when I went home last night and tried the same program on my Mac with OS X and it worked fine.

Then I read your reply and sure enough, I was using a more up-to-date driver on the Mac than on my work PC. Synching to the same driver did the trick.

Thanks again!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.