-->
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.  [ 1 post ] 
Author Message
 Post subject: Entity insert causes column index is out of range on postgre
PostPosted: Tue Sep 13, 2011 6:41 am 
Contributor
Contributor

Joined: Fri Apr 03, 2009 11:07 am
Posts: 11
I am seeing the following exception using Hibernate bundled in AS7 and a postgresql database. Version of AS7 is 7.1.0.Alpha1-SNAPSHOT.

05:03:35,397 DEBUG [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-jentp-jbossas-10.0.1.2-8080-1) The column index is out of range: 7, number of columns: 6. [n/a]: org.postgresql.util.PSQLException: The column index is out of range: 7, number of columns: 6.

I have an ejb3 entity that is being inserted to the database. With statement logging on this is logged by Hibernate.

04:41:18,165 DEBUG [org.hibernate.engine.jdbc.spi.SqlStatementLogger] (http-jentp-jbossas-10.0.1.2-8080-4) insert into O_CUSTINVENTORY (CI_CUSTOMERID, CI_QUANTITY, CI_VALUE, CI_ITEMID, CI_VERSION, CI_ID) values (?, ?, ?, ?, ?, ?)

Using a debugger I am seeing this (partial) call stack. The call into dehydrate passes an index of 6 but the call to nullSafeSet passes 7. Further up the call stack the postgresql driver throws the PSQLException exception. Full call stack is at the end of this message.

org.hibernate.persister.entity.AbstractEntityPersister
protected void insert( final Serializable id, final Object[] fields, final boolean[] notNull, final int j, final String sql, final Object object, final SessionImplementor session) throws HibernateException

int index = 1
line 2836

next call

org.hibernate.persister.entity.AbstractEntityPersister
protected int dehydrate( final Serializable id, final Object[] fields, final Object rowId, final boolean[] includeProperty, final boolean[][] includeColumns, final int j, final PreparedStatement ps, final SessionImplementor session, int index) throws SQLException, HibernateException

int index = 6
line 2599

next call

org.hibernate.type.ComponentType
public void nullSafeSet(PreparedStatement st, Object value, int begin, SessionImplementor session)

int begin (index) = 7
line 358


The versions of hibernate libraries are

<version.org.hibernate>4.0.0.CR1</version.org.hibernate>
<version.org.hibernate.commons.annotations>3.2.0.Final</version.org.hibernate.commons.annotations>
<version.org.hibernate.javax.persistence.hibernate-jpa-2.0-api>1.0.1.Final</version.org.hibernate.javax.persistence.hibernate-jpa-2.0-api>
<version.org.hibernate.validator>4.2.0.Final</version.org.hibernate.validator>

Version of postgres
database: 8.4.7
jdbc driver: 9.1-901

Is there something I should be checking ?

Regards,
Jeremy



Thread [Thread-21 (group:HornetQ-server-threads1347605188-1885727776)] (Running)
SimpleParameterList.bind(int, Object, int) line: 53
SimpleParameterList.setLiteralParameter(int, String, int) line: 114
Jdbc4PreparedStatement(AbstractJdbc2Statement).bindLiteral(int, String, int) line: 2176
Jdbc4PreparedStatement(AbstractJdbc2Statement).setInt(int, int) line: 1214
CachedPreparedStatementJDK6(CachedPreparedStatement).setInt(int, int) line: 155
WrappedPreparedStatementJDK6(WrappedPreparedStatement).setInt(int, int) line: 200
GeneratedMethodAccessor15.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 616
PreparedStatementProxyHandler(AbstractStatementProxyHandler).continueInvocation(Object, Method, Object[]) line: 124
PreparedStatementProxyHandler(AbstractProxyHandler).invoke(Object, Method, Object[]) line: 80
$Proxy79.setInt(int, int) line: not available
IntegerTypeDescriptor$1.doBind(PreparedStatement, X, int, WrapperOptions) line: 57
IntegerTypeDescriptor$1(BasicBinder<J>).bind(PreparedStatement, J, int, WrapperOptions) line: 82
IntegerType(AbstractStandardBasicType<T>).nullSafeSet(PreparedStatement, Object, int, WrapperOptions) line: 305
IntegerType(AbstractStandardBasicType<T>).nullSafeSet(PreparedStatement, Object, int, SessionImplementor) line: 300
EmbeddedComponentType(ComponentType).nullSafeSet(PreparedStatement, Object, int, SessionImplementor) line: 358
SingleTableEntityPersister(AbstractEntityPersister).dehydrate(Serializable, Object[], Object, boolean[], boolean[][], int, PreparedStatement, SessionImplementor, int) line: 2599
SingleTableEntityPersister(AbstractEntityPersister).insert(Serializable, Object[], boolean[], int, String, Object, SessionImplementor) line: 2836
SingleTableEntityPersister(AbstractEntityPersister).insert(Serializable, Object[], Object, SessionImplementor) line: 3276
EntityInsertAction.execute() line: 80
ActionQueue.execute(Executable) line: 273
ActionQueue.executeActions(List) line: 265
ActionQueue.executeActions() line: 186
EJB3FlushEventListener(AbstractFlushingEventListener).performExecutions(EventSource) line: 336
EJB3FlushEventListener(DefaultFlushEventListener).onFlush(FlushEvent) line: 50
SessionImpl.flush() line: 1073
SessionImpl.managedFlush() line: 318
SynchronizationCallbackCoordinatorImpl.beforeCompletion() line: 104
RegisteredSynchronization.beforeCompletion() line: 54
SynchronizationImple.beforeCompletion() line: 97
AtomicAction(TwoPhaseCoordinator).beforeCompletion() line: 274
AtomicAction(TwoPhaseCoordinator).end(boolean) line: 94
AtomicAction(AtomicAction).commit(boolean) line: 159
TransactionImple.commitAndDisassociate() line: 1159
TransactionManagerImple(BaseTransaction).commit() line: 119
TransactionManagerDelegate(BaseTransactionManagerDelegate).commit() line: 75
CMTTxInterceptor(CMTTxInterceptor).endTransaction(TransactionManager, Transaction) line: 92
CMTTxInterceptor(CMTTxInterceptor).invokeInOurTx(TransactionalInvocationContext, TransactionManager) line: 265
CMTTxInterceptor(CMTTxInterceptor).required(TransactionalInvocationContext) line: 359
CMTTxInterceptor(CMTTxInterceptor).invoke(TransactionalInvocationContext) line: 219
CMTTxInterceptor.processInvocation(InterceptorContext) line: 35
InterceptorContext.proceed() line: 287
SessionInvocationContextInterceptor.processInvocation(InterceptorContext) line: 71
InterceptorContext.proceed() line: 287
ChainedInterceptor.processInvocation(InterceptorContext) line: 61
ViewDescription$1.processInvocation(InterceptorContext) line: 146
InterceptorContext.proceed() line: 287
ChainedInterceptor.processInvocation(InterceptorContext) line: 61
ProxyInvocationHandler.invoke(Object, Method, Object[]) line: 76
OrderSessionLocal$$$view4.newOrder(int, ShoppingCart, int, boolean, boolean) line: not available
SpecAction.doPurchase(int, ShoppingCart, int, boolean, boolean) line: 340
SpecAction.atomicityTestTwo() line: 151
SpecServletAction.doAtomicityTests(ServletContext, HttpServletRequest, HttpServletResponse) line: 1070
SpecAppServlet.performTask(HttpServletRequest, HttpServletResponse) line: 140
SpecAppServlet.doGet(HttpServletRequest, HttpServletResponse) line: 78
SpecAppServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 734
SpecAppServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 847
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 329
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 248
StandardWrapperValve.invoke(Request, Response) line: 275
StandardContextValve.invoke(Request, Response) line: 161
SecurityContextAssociationValve.invoke(Request, Response) line: 139
NamingValve.invoke(Request, Response) line: 57
WebNonTxEmCloserValve.invoke(Request, Response) line: 49
StandardHostValve.invoke(Request, Response) line: 154
ErrorReportValve.invoke(Request, Response) line: 102
StandardEngineValve.invoke(Request, Response) line: 109
CoyoteAdapter.service(Request, Response) line: 362
Http11Processor.process(Socket) line: 877
Http11Protocol$Http11ConnectionHandler.process(Socket) line: 667
JIoEndpoint$Worker.run() line: 952
Thread.run() line: 636


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

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.