* [BAEL-1981] Article entity and repository + tests

* [BAEL-1981] Removing unnecessary fields

* [BAEL-1981] spring-data-jpa module creation
This commit is contained in:
François Dupire 2018-07-23 06:49:25 +02:00 committed by maibin
parent ecb14dd834
commit 0be7aa087f
8 changed files with 57 additions and 0 deletions

View File

@ -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>

26
spring-data-jpa/pom.xml Normal file
View File

@ -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>

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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