0

I am trying to migrate the versions of spring framework as well as that of hibernate. For spring framework I moved the version from 3.2.18 to 4.3.20. After that I have upgraded hibernate version from 3.5.6-Final to 5.4.18.Final. I did all the migration related changes to make my code compilation free and built my application successfully.

But, at the deployment time in my local JBOSS I got an issue "JdbcEnvironmentImpl Could not fetch the SequenceInformation from the database due to

com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=SYSCAT.SEQUENCES, DRIVER = 4.25.1301.... Mainly Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set".

I am having the below entry(i.e., in existing code before migration) in my project's application context xml(i.e., hibernate configuration file).

"hibernate.dialect"=org.hibernate.dialect.DB2Dialect(inside property xml tag)

I have changed this dialect name to all varieties of the DB2 dialects(e.g., DB2400Dialect, DB2390Dialect, DB297Dialect etc.), but no luck. After going through different blogs I have found that for hibernate 5 the actual DB2 dialect is "org.hibernate.dialect.DB2" instead of "org.hibernate.dialect.DB2Dialect".

After using this new dialect in my application currently I am getting -

"Unable to resolve name [org.hibernate.dialect.DB2] as Strategy [org.hibernate.dialect.Dialect]....Unable to load class [org.hibernate.dialect.DB2]".

Could anybody please help me on this. Please suggest what needs to be done to sort out this problem at JBOSS runtime so that I can deploy my application.

mao
  • 11,321
  • 2
  • 13
  • 29
Ritesh_RM
  • 13
  • 6

1 Answers1

0

according to Hibernate 5.4 User Guide / Database Dialect it should be hibernate.dialect=DB2 (w/o org.hibernate.dialect)

DB2 values from the referenced table are:

  • DB2: Support for the DB2 database, version 8.2.
  • DB297: Support for the DB2 database, version 9.7.
  • DB2390: Support for DB2 Universal Database for OS/390, also known as DB2/390.
  • DB2400: Support for DB2 Universal Database for iSeries, also known as DB2/400.
  • DB2400V7R3: Support for DB2 Universal Database for i, also known as DB2/400, version 7.3
  • I have tried with both hibernate.dialect=DB2 and hibernate.dialect=DB2Dialect in place of hibernate.dialect=org.hibernate.dialect.DB2Dialect, but no luck. For hibernate.dialect=DB2 I got SQLCODE=-204 for Syscat.Sequences table(means table or schema does not exist). Due to this error DB2 dialect not set.Syscat.Sequences table is present inside org.hibernate.dialect.DB2Dialect class and this is mainly used to extract sequence information.For hibernate.dialect=DB2Dialect I got Unable to resolve name [DB2Dialect] as Strategy [org.hibernate.dialect.Dialect], Unable to load class [DB2Dialect] error. – Ritesh_RM Jan 20 '21 at 15:13
  • Actually hibernate 5.4.x cannot set existing DB2Dialect(i.e., working fine with hibernate 3.5.6.Final) because hibernate 5.4.x cannot find syscat.sequences table at runtime. Can anybody please help me on this. – Ritesh_RM Jan 20 '21 at 15:13
  • the similar question's anser references DB2400 dialect as a solution https://stackoverflow.com/questions/59610468/sequenceinformation-missing – Олександр Демура Mar 12 '21 at 09:47