I think it is a bug in the Postgres implementation of JDBC batch updates.

Gerry Duprey wrote:

Howdy,

I'm new to hibernate and have run into a problem almost immediatly in my test
program while trying to save a new object/record. I've tried this with
Hibernate 2.0.3 and 2.1b3. This is on PostreSQL7.


After creating a hibernatable object instance, I attempt to save it and close
the transaction. When I do, I get an exception like this:


16:29:31,379 DEBUG BatcherImpl:24 - Adding to batch
16:29:31,381 DEBUG BatcherImpl:46 - Executing batch size: 1
16:29:31,423 ERROR BatcherImpl:62 - 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:50)

  at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:116)
  at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2281)

There is more and I can provide it if necessary. The code for xreating and committing the
new record looks like:


    Session theSession = theContext.getSession();
    Transaction theTransaction = theSession.beginTransaction();

UserProfile baseUser = (UserProfile) theSession.load(UserProfile.class,
new Integer(1));
UserRole baseRole = (UserRole) theSession.load(UserRole.class, new
Integer(1));
DAOChangeNote changeNote = (DAOChangeNote)
DAOCommonFactory.getFactory().createChangeNote(baseUser);


    UserProfile theUser = (UserProfile)
DAOCommonFactory.getFactory().createUserProfile();

    theUser.setName(userName);
    //theUser.setFullName(new Name());
    theUser.setRole(baseRole);
    theUser.setChangeNote(changeNote);

    theSession.save(theUser);
    theSession.flush();
    theSession.commitTransaction();

The error occurs when I do the theSession.flush(). I'm pretty sure the
mappings are OK because I am able to load up other records of this same table
(the baseUser theSession.load() call) and it seems to work.


I realize there are probably hundreds of different places where this could be
going wrong. If someone could suggest a few likely things to check,
I'd appreciate it.


Thanks much!

Gerry




------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to