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
|