-->
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.  [ 2 posts ] 
Author Message
 Post subject: Exception on insert and update
PostPosted: Tue Dec 14, 2004 5:56 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
i am getting java.lang.ArrayIndexOutOfBoundException in
Transaction tx.commit()
please help !!! urgently

theEvent object -> id (long,primary key), eventtitle(String), date(Date)
table EVENTS -> uid(decimal) ,eventtitle(varchar), date(date)


Hibernate version:
2.1

Mapping documents:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<class name="de.gloegl.road2hibernate.Event" table="EVENTS" dynamic-update="true">

<id name="id" column="uid" type="long">
<generator class="net.sf.hibernate.id.SequenceGenerator"/>

</id>
<property name="title" column="eventtitle" type="string" />
<property name="date" column="date" type="timestamp" />

</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();

Event theEvent = new Event();

theEvent.setDate(theDate);
theEvent.setTitle(title);

session.save(theEvent);
System.out.println("isS COnnecTED : "+ session.isConnected());
System.out.println("WAS COMMITED : "+tx.wasCommitted());
session.flush();
tx.commit();
System.out.println("After Commit");
System.out.println("WAS COMMITED : "+tx.wasCommitted());

session.close();
}catch(ArrayIndexOutOfBoundsException e){
System.out.println("EXCEPTION :: "+ e);
e.printStackTrace();
}
catch (HibernateException e) {
e.printStackTrace();
}

Full stack trace of any exception that occurs:

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 net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2367)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at de.gloegl.road2hibernate.EventManager.store(EventManager.java:60)
at de.gloegl.road2hibernate.EventManager.main(EventManager.java:108)

Name and version of the database you are using:

postgreSQL 7.4.5

The generated SQL (show_sql=true):

Hibernate: insert into EVENTS (eventtitle, date, uid) values (?, ?, ?)

Debug level Hibernate log excerpt:
...
INFO - cleaning up connection pool: jdbc:postgresql://192.168.0.13:5432/sherindb
Finished Initializing Hibernate
Hibernate: select nextval ('hibernate_sequence')
----
1
TestEvent
Tue Dec 14 15:20:28 IST 2004
----
isS COnnecTED : true
WAS COMMITED : false
Hibernate: insert into EVENTS (eventtitle, date, uid) values (?, ?, ?)
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 net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2367)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at de.gloegl.road2hibernate.EventManager.store(EventManager.java:60)
at de.gloegl.road2hibernate.EventManager.main(EventManager.java:108)
EXCEPTION :: java.lang.ArrayIndexOutOfBoundsException: 1


Top
 Profile  
 
 Post subject: exception using in query execution
PostPosted: Tue Jan 25, 2005 9:56 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
The problem can be solved using postgresql new driver named pg74.215.jdbc3.jar...
Copy this particular jar to JBOSS_HOME/server/default/lib and restart the server.

Be carefull, This driver won't work with WebRowset and CachedRowSet...
If anybody got that problem solved please forward that to the forum


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.