SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Starting point

hxe-hibernate-google-app-engine

A Java demo application that runs Spring and Hibernate against a SAP HANA database, including geospatial queries through the HANA Hibernate Spatial dialect, locally or on Google App Engine.

Connecting a Java application to SAP HANA through Hibernate for more than standard SQL, such as geospatial data, means working out which dialect handles it. This demo loads a San Francisco police-incident dataset and an address dataset into HANA, then runs geospatial queries through the HANA Hibernate Spatial dialect executed by SAP HANA's geospatial engine, and can be run locally with Maven or deployed to Google App Engine. It can serve as a starting point for developing other Java applications, or to see how the connection and the queries are set up.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
Database connectorsBTPDatabase connectorscapabilityConnecting an application’s data model and queries to a database, including the differences in supported queries, types and schema management between database implementations. Changing an existing schema belongs to [schema evolution](capability:schema-evolution).
Requires
SAP HANASAP HANAartifactthe database the application stores its incident and address data in and runs its SQL and geospatial queries against.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Jonathan BreglerPersonContributes to this
In the atlas: contributes to 3
@breglerj
Brian BernardPersonContributes to this
In the atlas: contributes to 64
@btbernard
Jonathan BakerPersonContributes to this
In the atlas: contributes to 9
@jonathanbaker7
4 contributors

What it declares

Every artifact

Type
Sample
Origin
By SAP

As a sample

Form
A reference application

Connections3

README

quoted from SAP-samples/hxe-hibernate-google-app-engine under Apache-2.0, read
SAP-samples/hxe-hibernate-google-app-engine/README.mdOn GitHub

REUSE status

Description

This project is a demo application illustrating how to build Java applications with Spring and Hibernate on SAP HANA. It can serve as a starting point for developing other Java applications or simply provide insights on how to set up an application and how to run queries against the database.

In addition to standard SQL queries this application also contains examples for geospatial queries. The geospatial queries are sent to the database via the HANA Hibernate Spatial dialect and executed by SAP HANA's geospatial engine.

Requirements

Hardware

Software

Download and Installation

Download

Clone this repository to your local computer.

Installation

NOTE: all relative paths are relative to the project root directory. All commands are expected to be run from the project root directory.

Copy the data sets

Place the incidents and addresses data sets into the src/main/resources/csv directory as incidents.csv and addresses.csv, respectively. If you prefer a different location or different file names you can adjust the configuration properties csv.incidents.file.location and csv.addresses.file.location in the file src/main/resources/application.properties.

Add the API key

Edit the file pom.xml and add your Google Cloud Platform API key as the value of the property google.api.key.

...
<properties>
	...
	<google.api.key>REPLACE_WITH_YOUR_API_KEY</google.api.key>
	...
</properties>
...
Database setup

The database tables used for storing the application data are automatically created by the application using the SQL script located at src/main/resources/db/migration/V1__CreateSchema.sql.

Adjust the JDBC connection data

Edit the file pom.xml and adjust the properties jdbc.username, jdbc.password, jdbc.host, and jdbc.port to match the connection data of your SAP HANA instance.

...
<properties>
	...
		<jdbc.username>DEMO_USER</jdbc.username>
		<jdbc.password>D3m0-U$eR</jdbc.password>
		<jdbc.host>HOSTNAME OR IP</jdbc.host>
		<jdbc.port>SQL PORT</jdbc.port>
	...
</properties>
...

For local testing make sure to also adjust these properties in the m2e profile.

...
<profiles>
	<profile>
		<id>m2e</id>
		...
		<properties>
			...
				<jdbc.username>DEMO_USER</jdbc.username>
				<jdbc.password>D3m0-U$eR</jdbc.password>
				<jdbc.host>HOSTNAME OR IP</jdbc.host>
				<jdbc.port>SQL PORT</jdbc.port>
			...
		</properties>
	</profile>
</profiles>
...
Run the application locally

You can run the application by executing the following Maven command from the application's root directory:

> mvn spring-boot:run

If you have separated the configuration into a default cloud configuration and a local configuration using the m2e profile, you have to specify the profile ID when running the Maven command:

> mvn spring-boot:run -P m2e

NOTE: the first startup of the application can take a while, because the applications needs to load all the data from the CSV files. Subsequent startups will be much faster.

Once the application has started you can access it by navigating to http://localhost:8080 in a web browser.

Deploy the application to the Google Cloud Platform

Deploying the application to the cloud can be done using the configured Google App Engine Maven Plugin.

Before the application can be deployed to the cloud you must create a GCP project and add it's ID to the Maven build descriptor. To do this, edit the file pom.xml and replace the value of the property google.project.id with your actual project ID.

...
<properties>
	...
		<google.project.id>REPLACE_WITH_YOUR_PROJECT_ID</google.project.id>
	...
</properties>
...

After that you can deploy the application to the cloud by running the following Maven command:

> mvn appengine:update

Once the application has been deployed you can access it by navigating to http://<your-project-id>.appspot.com in a web browser.

Configuration

The application can be configured using the properties in the file src/main/resources/application.properties.

Google Cloud Translation API

Translating the application UI using the Google Cloud Translation API is disabled by default. It can be enabled by setting the property translation.enabled to true.

translation.enabled=true

CSV file locations

The locations and names of the CSV files containing the incident and address data can be configured by setting the properties csv.incidents.file.location and csv.addresses.file.location, respectively.

csv.incidents.file.location=/csv/incidents.csv
csv.addresses.file.location=/csv/addresses.csv

JDBC batch size

If the database tables are empty, the application tries to load the data from the specified CSV files. Since there are many records to be imported, the import can be significantly sped up by using batch inserts. The size of a batch can be controlled by setting the property spring.jpa.properties.hibernate.jdbc.batch_size.

spring.jpa.properties.hibernate.jdbc.batch_size=50

The default batch size is 50, but you may want to experiment with larger values for the initial load.

Debugging SQL statements

If you want to debug the SQL statements that are sent to the database you can set the property spring.jpa.show-sql to true. Then the SQL statements are logged to the configured logger. If you also want to see the values of the statement parameters that are sent to or retrieved from the database you can set the logging level of org.hibernate.type.descriptor.sql.BasicBinder and org.hibernate.type.descriptor.sql.BasicExtractor to info.

spring.jpa.show-sql=true

logging.level.org.hibernate.type.descriptor.sql.BasicBinder=info
logging.level.org.hibernate.type.descriptor.sql.BasicExtractor=info

Limitations

There are currently no limitations

Known Issues

There are currently no known issues

How to obtain support

This project is provided as-is. New features may be added occasionally.

There is no support for this project. You may raise issues via the issue tracker, but there is no guarantee they will be processed.

To-Do (upcoming changes)

Currently the address search implementation uses standard SQL LIKE queries. This has several drawbacks:

  • No ordering of results
  • Only exact matches

These drawbacks can be addressed by using SAP HANA fuzzy text search.

License

Copyright (c) 2018-2026 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
github.com/SAP-samples/hxe-hibernate-google-app-enginetree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, data-and-persistence
Contributors4

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-hxe-hibernate-google-app-engine
JSON
/artifacts/sap-samples-hxe-hibernate-google-app-engine.json
MCP
Connecting an agent