Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@
<module>spring-data-couchbase-2</module>
<module>persistence-modules/spring-data-dynamodb</module>
<module>spring-data-elasticsearch</module>
<module>spring-data-jpa</module>
<module>spring-data-keyvalue</module>
<module>spring-data-mongodb</module>
<module>persistence-modules/spring-data-neo4j</module>
Expand Down
26 changes: 26 additions & 0 deletions spring-data-jpa/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-data-jpa</artifactId>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>

</project>
14 changes: 14 additions & 0 deletions spring-data-jpa/src/main/java/com/baeldung/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.baeldung;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class Application {
private static ApplicationContext applicationContext;

public static void main(String[] args) {
applicationContext = SpringApplication.run(Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.baeldung.repository;

import com.baeldung.domain.Article;
import com.baeldung.repository.ArticleRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
15 changes: 15 additions & 0 deletions spring-data-jpa/src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# spring.datasource.x
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
spring.datasource.username=sa
spring.datasource.password=sa

# hibernate.X
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-drop
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory

spring.datasource.data=import_articles.sql