I needed to use sql by connecting MyBatis.
I have updated spring.xml file as recommented (Integration with MyBatis - CUBA Platform. Developer’s Manual) and received an error.
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property ‘cubaDataSource’ of bean class [org.mybatis.spring.SqlSessionFactoryBean]: Bean property ‘cubaDataSource’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243)
Please post the simplest example of a working project (Person = id + name). Using postgreSql with its UUID id.
Thanks.
Further on the text of the example
SqlSession sqlSession = AppBeans.get(“sqlSession”);
Execption “NoSuchBeanDefinitionException: No bean named “sqlSeccion” available”.
Works
SqlSessionFactory sqlSessionFactory = AppBeans.get(“sqlSessionFactory”);
SqlSession sqlSession = sqlSessionFactory.openSession();
but
order = (Order) sqlSession.selectOne(“com.sample.sales.selectOrder”, orderId);
again gives an error “Error querying database. Cause: org.hsqldb.HsqlException: incompatible data type in conversion” - parameter must be “customerId”.
Do I have to manually close the myBatis session or the Cube itself?
Please post the simplest example of a working project (Person = id + name). Using postgreSql with its UUID id.
I have created the sample project (see attachment).
Button “Amount” on the Orders browser screen finds order using MyBatis and shows selected order amount.
Do I have to manually close the MyBatis session or the Cube itself?
MyBatis session will be closed automatically by a transaction commit.