-->
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.  [ 11 posts ] 
Author Message
 Post subject: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Fri Nov 03, 2017 6:56 am 
Newbie

Joined: Fri Nov 03, 2017 6:47 am
Posts: 6
I am receiving Hibernate exception - SQL Error: 17003, SQLState: 99999. for below query. It seems instead of this char '?' null is getting passed whenever set parameter is being called then it does not found it's index.

Please suggest. I am not sure but what I can see suggested above. Now I am not able to solve this this. Please help here.

Hibernate: update TR_LTM_RTL_TRN set DC_DY_BSN=null, ID_STR_RT=null, AI_TRN=null, ID_WS=null where DC_DY_BSN=? and ID_STR_RT=? and AI_TRN=? and ID_WS=? and AI_LN_ITM=?

[2017-11-03 16:09:01,067] [ WARN] [JDBCExceptionReporter.logExceptions() - 233] SQL Error: 17003, SQLState: 99999
[2017-11-03 16:09:01,067] [ERROR] [JDBCExceptionReporter.logExceptions() - 234] Invalid column index
[2017-11-03 16:09:01,075] [DEBUG] [ExceptionResolver.handleDefaultException() - 95] org.springframework.jdbc.InvalidResultSetAccessException: Hibernate flushing: could not delete collection rows: [com.starmount.engage.model.orpos._12_0.RetailTransaction.lineItems#component[businessDay,retailStoreId,transactionSequenceNumber,workstationId]{retailStoreId=11511, businessDay=2017-08-28, transactionSequenceNumber=328, workstationId=245}]; invalid ResultSet access for SQL [update TR_LTM_RTL_TRN set DC_DY_BSN=null, ID_STR_RT=null, AI_TRN=null, ID_WS=null where DC_DY_BSN=? and ID_STR_RT=? and AI_TRN=? and ID_WS=? and AI_LN_ITM=?]; nested exception is java.sql.SQLException: Invalid column index
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:237)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertJdbcAccessException(HibernateTransactionManager.java:805)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:791)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:392)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Fri Nov 03, 2017 8:08 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Try with named parameters and see how it works.


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Fri Nov 03, 2017 10:35 am 
Newbie

Joined: Fri Nov 03, 2017 6:47 am
Posts: 6
I am not creating any query here. Its just an persistence update operation, where there are individual columns are making composite key for another table. Please suggest, I also put insertable=false, updatable = false on join columns as well even though I am receiving exception.


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Fri Nov 03, 2017 11:37 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I'm suggesting that the mapping might be wrong. Only you can tell that since we haven't seen it so far.


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Mon Nov 06, 2017 3:47 am 
Newbie

Joined: Fri Nov 03, 2017 6:47 am
Posts: 6
@Entity
@Table(name = "OR_ORD")
public class Order implements java.io.Serializable {

private Set<OrderLineItem> lineItems;

}

@Entity
@Table(name = "OR_LTM")
public class OrderLineItem implements java.io.Serializable {
}

We have below properties from above class/DB objects that are responsible to composite primary key for another table TR_LTM_RTL_TRN
Column name Table name Part of primary key
---------------- ------------- ---------------------
DC_DY_BSN OR_ORD part of primary key
ID_STR_RT OR_ORD not a part of primary key\just as column
AI_TRN OR_LTM not a part of primary key \ just as column
ID_WS OR_LTM not a part of primary key\just as column
AI_LN_ITM OR_LTM part of primary key

We are calling below code

dao.update(order);

Its a plane JPA update, then there we are receiving exception. I tried to avoid update TR_LTM_RTL_TRN with below code :
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "retailStoreId", column = @Column(name = "ID_STR_RT", unique = false,
nullable = false, insertable = false, updatable = false, length = 5)),
@AttributeOverride(name = "workstationId", column = @Column(name = "ID_WS", unique = false,
nullable = false, insertable = false, updatable = false, length = 3)),
@AttributeOverride(name = "businessDay", column = @Column(name = "DC_DY_BSN", unique = false,
nullable = false, insertable = false, updatable = false, length = 10)),
@AttributeOverride(name = "transactionSequenceNumber", column = @Column(name = "AI_TRN", unique = false,
nullable = false, insertable = false, updatable = false, precision = 0)),
@AttributeOverride(name = "retailTransactionLineItemSequenceNumber", column = @Column(name = "AI_LN_ITM",
unique = false, nullable = false, insertable = false, updatable = false, precision = 0)) })
public RetailTransactionLineItemId getId() {
return this.id;
}


However It does not work and still we are getting. Invlaid index column


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Mon Nov 06, 2017 3:57 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Why did you set:

Code:
insertable = false, updatable = false


for the attributes that make your composite identifier?

How would Hibernate be able to insert such a row in the database?


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Mon Nov 06, 2017 4:12 am 
Newbie

Joined: Fri Nov 03, 2017 6:47 am
Posts: 6
I thought I could stop updating composite key columns. That's why I put.

I do not know, why hibernate is updating composite key table "TR_LTM_RTL_TRN" .Please suggest any thing wrong at my understanding or suggest to fix this.


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Mon Nov 06, 2017 5:21 am 
Newbie

Joined: Fri Nov 03, 2017 6:47 am
Posts: 6
Please suggest is this is a JPA issue. We are using Hibernate JPA 2.0.


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Mon Nov 06, 2017 5:56 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
And RetailTransactionLineItemId, how does it look like?


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Mon Nov 06, 2017 6:03 am 
Newbie

Joined: Fri Nov 03, 2017 6:47 am
Posts: 6
Its an object of all composite properties of table TR_LTM_RTL_TRN.


Top
 Profile  
 
 Post subject: Re: Hibernate - SQL Error: 17003, SQLState: 99999
PostPosted: Mon Nov 06, 2017 7:39 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Most likely the mapping is wrong. But, since you don't show it all, it's impossible to tell.


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