The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
<dependency>
<groupId>com.github.vogel612</groupId>
<artifactId>spring-data-hanadb</artifactId>
<version>1.5</version>
</dependency>
-
Following properties can be used in your
application.yml
:spring: hana: url: http://localhost/ authorization-header: basic authenticationToken== data-endpoint: SensorData stats-endpoint: SensorStats
When your connection is based on HTTPS it may be necessary to specify a
trust-store
underhana
like so:trust-store: location: /path/to/java/keystore/file password: securepassword
The information given here will be used to set the system properties
javax.net.ssl.trustStore
andjavax.net.ssl.trustStorePassword
, which in turn govern how SSL certificates are validated. -
Create
HanaDBConnectionFactory
andHanaDBTemplate
beans:@Configuration @EnableConfigurationProperties(HanaDBProperties.class) public class HanaDBConfiguration { @Bean public HanaDBTemplate<Point> template(final HanaDBProperties properties) { /* * You can specify a custom PointConverter implementation as the second parameter, * if you want to use your own Measurement container */ return new DefaultHanaDBTemplate(properties); } }
-
Use
HanaDBTemplate
to interact with the HanaDB database:@Autowired private HanaDBTemplate<Point> hanaDBTemplate; final Point p = Point.timeseries("disk") .time(System.currentTimeMillis()) .value(12.25) .build(); hanaDBTemplate.write(p);
Spring Data HanaDB uses Maven as its build system.
mvn clean install