I am getting an exception with spring boot with postgres DB when using a sequence generator.
Below is the stacktrace
2020-01-17 15:54:10 - SQL Error: 0, SQLState: 42P01
2020-01-17 15:54:10 - ERROR: relation "predefmapping_seq" does not exist
Position: 17
2020-01-17 15:54:13 - Error adding tags to the DB:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not
extract ResultSet
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149) ~
[hibernate-core-5.2.17.Final.jar!/:5.2.17.Final]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157) ~
[hibernate-core-5.2.17.Final.jar!/:5.2.17.Final]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:164) ~
[hibernate-core-5.2.17.Final.jar!/:5.2.17.Final]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:790) ~[hibernate-core-
5.2.17.Final.jar!/:5.2.17.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:768) ~[hibernate-core-
5.2.17.Final.jar!/:5.2.17.Final]
at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~ [na:1.8.0_232]
Below is the Entinty class column for which the sequence is added.
#Id
#SequenceGenerator(name="PREDEFMAPPING_SEQ", sequenceName="PREDEFMAPPING_SEQ",initialValue = 1, allocationSize=1)
#GeneratedValue(strategy = GenerationType.AUTO ,generator="PREDEFMAPPING_SEQ")
#Column(name = "ID")
private long id;
Note that this has been tested with db2, oracle and mssql. However for postgres it is giving me the above exception.
The sequence name in postgres db table is "predefmap_seq" and not "PREDEFMAPPING_SEQ" as in the entity.
Most solutions suggest that I change the Generation strategy to IDENTITY however I wanted a solution which would be applicable to all (db2, oracle, mssql and postgres)
Related
I am not able to figure out what's wrong in following jpql query, which I am using in spring boot project with spring data and hibernate 5.3.2.
select t from MdmVehicle t join MdmVehicleGateInOut g with g.vehicleNumber = t.number
Below is the exception I am getting:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: in near line 1, column 68 [select t.number from in.ecomexpress.mdm.entities.MdmVehicle t join in.ecomexpress.mdm.entities.MdmVehicleGateInOut g with g.vehicleNumber = t.number]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
at org.hibernate.hql.internal.ast.ErrorTracker.throwQueryException(ErrorTracker.java:93)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:296)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:188)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:143)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:119)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153)
at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:597)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:706)
... 172 more
This was fixed as part of https://hibernate.atlassian.net/browse/HHH-10953 already and there are tests for this, so I have to assume you are using an older Hibernate version (i.e. not the one you think you are using).
I am working on functionality where I need to fetch the data from DB based on the date. The date format in DB is yyyy-MM-dd and in my application, I am passing the date in the same form.
The day column in TempTable entity class is Date(java.util.Date). I used Temporal as well but no success.
Below is the java code:
EntityManagerFactory emf= Persistence.createEntityManagerFactory("punit");
EntityManager em = emf.createEntityManager();
Query query;
query = em.createQuery("select r from TempTable r where r.uId = :uid and r.day = :day group by r.mId, r.rId");
query.setParameter("uid", 5l);
SimpleDateFormat simpleDateFormat= new SimpleDateFormat("yyyy-MM-dd");
Date d = simpleDateFormat.parse("2018-10-12");
query.setParameter("day", d);
query.getResultList();
After execution of the code, found the exception as below:
Jan 13, 2020 3:11:20 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Unsupported conversion from TIMESTAMP to java.lang.Long
Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute query
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1535)
at org.hibernate.query.Query.getResultList(Query.java:165)
at com.abc.XXXXX.main(XXXXX.java:30)
Caused by: org.hibernate.exception.DataException: could not execute query
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:52)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.loader.Loader.doList(Loader.java:2818)
at org.hibernate.loader.Loader.doList(Loader.java:2797)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2629)
at org.hibernate.loader.Loader.list(Loader.java:2624)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:506)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:396)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:219)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1396)
at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1558)
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1526)
... 2 more
Caused by: java.sql.SQLDataException: Unsupported conversion from TIMESTAMP to java.lang.Long
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:114)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:96)
at com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1382)
at com.mysql.cj.jdbc.result.ResultSetImpl.getLong(ResultSetImpl.java:812)
at com.mysql.cj.jdbc.result.ResultSetImpl.getLong(ResultSetImpl.java:818)
at org.hibernate.type.descriptor.sql.BigIntTypeDescriptor$2.doExtract(BigIntTypeDescriptor.java:63)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:243)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:329)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:3041)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1866)
at org.hibernate.loader.Loader.hydrateEntityState(Loader.java:1794)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1767)
at org.hibernate.loader.Loader.getRow(Loader.java:1615)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:745)
at org.hibernate.loader.Loader.processResultSet(Loader.java:1008)
at org.hibernate.loader.Loader.doQuery(Loader.java:964)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:354)
at org.hibernate.loader.Loader.doList(Loader.java:2815)
... 11 more
Caused by: com.mysql.cj.exceptions.DataConversionException: Unsupported conversion from TIMESTAMP to java.lang.Long
at com.mysql.cj.result.DefaultValueFactory.unsupported(DefaultValueFactory.java:70)
at com.mysql.cj.result.DefaultValueFactory.createFromTimestamp(DefaultValueFactory.java:82)
at com.mysql.cj.protocol.a.MysqlTextValueDecoder.decodeTimestamp(MysqlTextValueDecoder.java:79)
at com.mysql.cj.protocol.result.AbstractResultsetRow.decodeAndCreateReturnValue(AbstractResultsetRow.java:87)
at com.mysql.cj.protocol.result.AbstractResultsetRow.getValueFromBytes(AbstractResultsetRow.java:241)
at com.mysql.cj.protocol.a.result.ByteArrayRow.getValue(ByteArrayRow.java:91)
at com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1290)
... 29 more
The configuration is:
Java8
Mysql8
JPA2.1
Spring5
Please check the TempTable entity class and db table structure. If you have anything miss match related to it then you have to map it accordingly. If there is anything the things will not work.
E.g.- java.util.Date column type must be match with Date type column in database.
I'm using a custom #Query with Spring JPA like this:
#Query(value = "select ua from USER_ACCOUNT ua where SUBSTRING(ssn, -4, 4) = :ssn and last_nm = :lastName and birth_dt = :dateOfBirth")
UserAccount findByLastFourOfSSNAndLastNameAndDateOfBirth(#Param("ssn") String lastFourOfSSN, #Param("lastName") String lastName, #Param("dateOfBirth") Date dateOfBirth);
It works without any problems when I run it locally, but as soon as I deploy it out to the development environment I get:
[2017-12-19T23:02:59,048] WARN org.hibernate.engine.jdbc.spi.SqlExceptionHelper SQL Error: 904, SQLState: 42000
[2017-12-19T23:02:59,048] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper ORA-00904: "SUBSTRING": invalid identifier
[2017-12-19T23:02:59,049] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[User Store] Servlet.service() for servlet [User Store] in context with path [] threw exception [org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
java.sql.SQLSyntaxErrorException: ORA-00904: "SUBSTRING": invalid identifier
The development environment is pretty much identical to my local. Same database, same version of Tomcat. Am I just missing something obvious here?
EDIT: SQL being generated:
select useraccoun0_.GUID as GUID1_5_, useraccoun0_.CREATED_BY as CREATED_BY2_5_, useraccoun0_.CREATED_DT as CREATED_DT3_5_, useraccoun0_.DB_NOTE as DB_NOTE4_5_, useraccoun0_.LAST_CHANGED_BY as LAST_CHANGED_BY5_5_, useraccoun0_.LAST_CHANGED_DT as LAST_CHANGED_DT6_5_, useraccoun0_.ACCOUNT_RECOVERY_EMAIL as ACCOUNT_RECOVERY_E7_5_, useraccoun0_.ACCOUNT_RECOVERY_PHONE as ACCOUNT_RECOVERY_P8_5_, useraccoun0_.BIRTH_DT as BIRTH_DT9_5_, useraccoun0_.DISABLED_IND as DISABLED_IND10_5_, useraccoun0_.DISABLED_DT as DISABLED_DT11_5_, useraccoun0_.DISABLED_REASON as DISABLED_REASON12_5_, useraccoun0_.email as email13_5_, useraccoun0_.FAILED_LOGIN_CNT as FAILED_LOGIN_CNT14_5_, useraccoun0_.FAILED_PASSWORD_RESET_DT as FAILED_PASSWORD_R15_5_, useraccoun0_.FIRST_NM as FIRST_NM16_5_, useraccoun0_.LAST_FAILED_LOGIN_DT as LAST_FAILED_LOGIN17_5_, useraccoun0_.LAST_LOGIN_DT as LAST_LOGIN_DT18_5_, useraccoun0_.LAST_NM as LAST_NM19_5_, useraccoun0_.LOCKED_IND as LOCKED_IND20_5_, useraccoun0_.LOCKED_CNT as LOCKED_CNT21_5_, useraccoun0_.LOCKED_DT as LOCKED_DT22_5_, useraccoun0_.USER_PASSWORD as USER_PASSWORD23_5_, useraccoun0_.PASSWORD_CHANGED_DT as PASSWORD_CHANGED_24_5_, useraccoun0_.PHONE_NBR as PHONE_NBR25_5_, useraccoun0_.REQUIRE_PASSWORD_RESET_IND as REQUIRE_PASSWORD_26_5_, useraccoun0_.SSN as SSN27_5_, useraccoun0_.USER_NM as USER_NM28_5_ from USER_ACCOUNT useraccoun0_ where substr(useraccoun0_.SSN, -4, 4)=? and last_nm=? and birth_dt=?
Intro:
We have a class annotated with #Document that has date fields.
E.g.
#Document(indexName = "notif-index", type = "notif-type", shards = 1, replicas = 0, refreshInterval = "-1")
public class NotifEntry {
...
#Field(type = FieldType.Date)// ? (type=FieldType.Date, format = DateFormat.custom, pattern = "dd.MM.yyyy")
private Date pubDate;
When trying to insert data for years we are getting the following error:
org.springframework.data.elasticsearch.ElasticsearchException: Bulk indexing has failures. Use ElasticsearchException.getFailedDocuments() for detailed messages [{104921=MapperParsingException[failed to parse [pubDate]]; nested: IllegalArgumentException[Invalid format: "-24303888000000" is malformed at "3888000000"];}]
at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.bulkIndex(ElasticsearchTemplate.java:588)
at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.save(AbstractElasticsearchRepository.java:176)
at sun.reflect.GeneratedMethodAccessor436.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:504)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:489)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
The specific date in question is: 1199-10-28 00:00:00
Elastic Search Repositories:
public interface NotifiEntryRepository extends ElasticsearchRepository<NotifEntry, String> { }
Questions:
IF we wanted to actually insert data like this how would we?
What is the max and min allowed dates in elastic search?
Update:
I tried converting the specific date to unix time format and am getting the following:
This is not the exact same number as in the exception, but it becomes obvious that elastic search is converting the Date into unix time (in MS) and the exception is taking place after that:
Invalid format: "-24303888000000" is malformed at "3888000000"]
-24303888000000 vs
-24304492800 * 1000ms
Update 2
It seems underneath this error we have a JODA time parsing error:
Example:
Caused by: java.lang.IllegalArgumentException: Invalid format: "32503680000000" is malformed at "3680000000"
at org.joda.time.format.DateTimeParserBucket.doParseMillis(DateTimeParserBucket.java:187)
at org.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:826)
at org.elasticsearch.index.mapper.core.DateFieldMapper$DateFieldType.parseStringValue(DateFieldMapper.java:366)
at org.elasticsearch.index.mapper.core.DateFieldMapper.innerParseCreateField(DateFieldMapper.java:534)
at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:241)
at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:321)
... 21 more
Update 3
I changed the specific dates from java.util.date but I am now getting the following error:
MapperParsingException[failed to parse [legalReference]]; nested: IllegalArgumentException[unknown property [year]];
at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:329)
at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrField(DocumentParser.java:311)
at org.elasticsearch.index.mapper.DocumentParser.parseObject(DocumentParser.java:328)
at org.elasticsearch.index.mapper.DocumentParser.parseObject(DocumentParser.java:254)
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:124)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:309)
at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:584)
at org.elasticsearch.index.shard.IndexShard.prepareIndexOnPrimary(IndexShard.java:563)
at org.elasticsearch.action.index.TransportIndexAction.prepareIndexOperationOnPrimary(TransportIndexAction.java:211)
at org.elasticsearch.action.index.TransportIndexAction.executeIndexRequestOnPrimary(TransportIndexAction.java:223)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:157)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:66)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase.doRun(TransportReplicationAction.java:657)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:287)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:279)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:378)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: unknown property [year]
at org.elasticsearch.index.mapper.core.DateFieldMapper.innerParseCreateField(DateFieldMapper.java:520)
at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:241)
at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:321)
Update 3
It seems that changing the type from #Field(type = FieldType.Date) to #Field(type = FieldType.String) solves the problem for now. Though it would be interesting to know exactly what effect this has.
I have a DB2 database configured for french accent characters and via the DB2 command line tool both of the following SQL statements successfully return results containing french accent characters.
select * from ca_cpo_inventory where dealer_id = 46170 and locale = 'fr'
and
select * from ca_cpo_inventory where dealer_id = 46170 and locale = 'en'
However in the JEE code the locale = 'fr' SQL works fine via Hibernate and PreparedStatement but the locale = 'en' result in the following exceptions. (note: Exceptions occur only when there are french characters in the English rows. If there are no french characters in result set the SQL works fine).
The same code is used to run both SQL, all that differs is locale.
When called via Hibernate:
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [...]; SQL state [null]; error code [-99999]; could not execute query; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:625)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:95)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:306)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:62)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:212)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:146)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy35.executeFinder(Unknown Source)
at com.mazdausa.persistence.dao.finder.impl.FinderIntroductionInterceptor.invoke(Unknown Source)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
....
Caused by:
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2216)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
at com.mazdausa.persistence.dao.impl.GenericDaoHibernateImpl.executeFinder(Unknown Source)
at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
... 90 more
Caused by:
com.ibm.db2.jcc.c.SqlException
at com.ibm.db2.jcc.c.s.a(s.java:1517)
at com.ibm.db2.jcc.c.s.m(s.java:465)
at com.ibm.db2.jcc.c.s.M(s.java:1102)
at com.ibm.db2.jcc.c.lf.getString(lf.java:959)
at com.ibm.db2.jcc.c.lf.getString(lf.java:1290)
at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getString(WSJdbcResultSet.java:1869)
at org.hibernate.type.StringType.get(StringType.java:18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2101)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
...
When called via PreparedStatement:
com.ibm.db2.jcc.c.SqlException
Does anyone know have any ideas? Since SQL statements work in DB2 console I am assuming there is no data corruption.