Select in SAP HANA + Hibernate gives an error: `Deployment of the com.sap.db.jdbc.CallableStatementSapDBFinalize method is not supported`

I have the following table:

CREATE column TABLE banks ( sk tinyint NOT NULL GENERATED BY DEFAULT AS IDENTITY, code varchar(10) DEFAULT NULL, name varchar(100) DEFAULT NULL, version smallint DEFAULT NULL, PRIMARY KEY (sk) ); 

I am trying to select table rows with the following code (in Scala):

 import scala.collection.JavaConverters._ object Test extends App { val session = HibernateUtil.sessionFactory.openSession val q = session.createQuery("from BankHib ") val list2 = q.list // <-- code breaks here session.close } 

The following entity definition:

 @Entity @Table(name = "banks") class BankHib { @Id var sk: Int = _ var code: String = _ var name: String = _ var version: Int = _ } 

And a utility for getting a factory session:

 object HibernateUtil { val sessionFactory = buildSessionFactory def buildSessionFactory = { try { new Configuration().configure().buildSessionFactory(); } catch {case ex:Throwable => println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } def shutdown { sessionFactory.close } } 

When I run the Test object, I get the following exception:

 Caused by: com.sap.db.jdbc.exceptions.SQLFeatureNotSupportedExceptionSapDB: Method unwrap of com.sap.db.jdbc.CallableStatementSapDBFinalize is not supported. at com.sap.db.jdbc.exceptions.SQLExceptionSapDB._createException(SQLExceptionSapDB.java:155) at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateSQLException(SQLExceptionSapDB.java:26) at com.sap.db.jdbc.WrapperDummy.unwrap(WrapperDummy.java:25) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:64) ... 26 more 

What is the problem and how to fix it? which function is not supported?

+8
scala hibernate hana
source share
1 answer

The exception begins with newly modified sleeping code.

A related issue is this: https://hibernate.atlassian.net/browse/HHH-10256

The change occurs in sleep mode 5.2.8. So, if you are using version 5.2.8+ (apparently, the error you pointed to version 5.2.10), can you try to upgrade to 5.2.7?

I'm worried because the very old juice drivers seem to be okay with the old code. If the new hana driver has problems with the new code, it will be difficult to find the correct match between the sleep mode version and the sap driver version.

If you have an exception from 5.2.7 and 5.2.10, you will have to reopen the hibernation problem.

And also you have SAP support for hana (if you use hana, you already pay for it), so contact them to have the best driver that supports JDBC correctly. They probably won’t even answer (you pay the product, this does not mean that there is an error, the error is always on your side), but who knows.

+2
source share

All Articles