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
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?
scala hibernate hana
ps0604
source share