Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Rui-Nogueira
Advisor
Advisor

Overview

ENROLL TO THE COURSE HERE (in case you haven't, yet): Course: Introduction to SAP HANA Cloud Platform (repeat)

You can find a list of the course guides for each week of this course in the corresponding parent project of this blog post.

Course Guide Week 2 - Persistency Basics

Hi everyone,

in the second week of the course Introduction to SAP HANA Cloud Platform we will provide you with some basics around the usage of the Persistence Service of our platform.

Find below additional information that can be useful to you during this course week. While monitoring the forums I'll also add some sections around common mistakes and how to fix them into the corresponding units.

Table of Contents

Unit 1 - Introduction & First Steps With EJB

Common Issues

Persistence operation failed with reason: The bean encountered a non-application exception

When inserting a value in the ejb sample’s UI he following exception is displayed:

Persistence operation failed with reason: The bean encountered a non-application exception; nested exception is: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [274]: inserted value too large for column: 49620af6-80cd-454b-a95b-258eab7e287c Error Code: 274 Call: INSERT INTO T_PERSONS (ID, FIRSTNAME, LASTNAME) VALUES (?, ?, ?) bind => [3 parameters bound] Query: InsertObjectQuery(com.sap.cloud.sample.persistence.Person@8de9f444)

Solution: You’re using HANA schema without setting the additional property: <property name="eclipselink.target-database" value="com.sap.persistence.platform.database.HDBPlatform"/> in the persistence.xml.

1. go the cockpit -> Your application -> Database Schemas and delete the schema of the application.

2. set the property in persistence.xml

3. deploy/run the application again

MaxDB, HANA database, and the Target Database

Some participants realized that after deployment of their application they ended up with a schema on a MaxDB rather than a HANA database. You can check this in the Cloud Cockpit. Just click on Database Schemas and check the database type of your schema.

In the course you learned how to set the target database to com.sap.persistence.platform.database.HDBPlatform. (in the video this step has been shown at around 10:20). It is necessary to instruct EclipseLink to use HANA specific commands, types, etc. to access (an already existing) HANA database. However, it does not create a schema on a HANA database.

Actually a schema is created when an application is deployed in the cloud for the first time. The DB type that is used depends on the default settings that you can control in the Cloud Cockpit. So what you have to do in addition is to change the default settings in the Cloud Cockpit to HANA as described in Changing the Default Database and deploy your application with a new name (that forces the creation of a new schema).

I don't see the JPA Content object in my eclipse IDE

  1. Right Click on your JPA project, in the menu which appears click on properties.
  2. In the properties window Select Project Facets.
  3. If Project Facets are not displayed click on link saying convert to facetted project.
  4. If Facets already available select Checkbox against JPA.
  5. Below  the Properties window a link appears "Further configurations required".
  6. Click on this link.
  7. In JPA facets window which appears select EclipseLink 2.X.X from Platform drop down and Disable Library Configuration from JPA Implementation drop down.
  8. Click OK

The JPA Content should appear now.

Unit 2 - Connecting To Your Database

Compared to the first course we've conducted last year it got much easier to connect to your HANA instance on the SAP HANA Cloud Platform via Eclipse or the SAP HANA Studio. The necessary db-tunnel is created for you automatically without you having to setup something.

Unit 3 - Creating A JDBC Application

Unit 4 - Sharing Data Between Applications

Unit 5 -Using Multiple Databases

38 Comments