[BAEL-14836] - Moved code for in-memory database article (#7705)

This commit is contained in:
Amit Pandey 2019-09-03 01:58:58 +05:30 committed by Josh Cummings
parent 149bfc44be
commit b0c1efdb7c
7 changed files with 43 additions and 1 deletions

View File

@ -9,3 +9,4 @@
- [Configuring a DataSource Programmatically in Spring Boot](https://www.baeldung.com/spring-boot-configure-data-source-programmatic) - [Configuring a DataSource Programmatically in Spring Boot](https://www.baeldung.com/spring-boot-configure-data-source-programmatic)
- [Resolving “Failed to Configure a DataSource” Error](https://www.baeldung.com/spring-boot-failed-to-configure-data-source) - [Resolving “Failed to Configure a DataSource” Error](https://www.baeldung.com/spring-boot-failed-to-configure-data-source)
- [Spring Boot with Hibernate](https://www.baeldung.com/spring-boot-hibernate) - [Spring Boot with Hibernate](https://www.baeldung.com/spring-boot-hibernate)
- [List of In-Memory Databases](http://www.baeldung.com/java-in-memory-databases)

View File

@ -59,6 +59,20 @@
<artifactId>validation-api</artifactId> <artifactId>validation-api</artifactId>
<version>${validation-api.version}</version> <version>${validation-api.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby.version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -83,6 +97,8 @@
<tomcat-jdbc.version>9.0.10</tomcat-jdbc.version> <tomcat-jdbc.version>9.0.10</tomcat-jdbc.version>
<mockito.version>2.23.0</mockito.version> <mockito.version>2.23.0</mockito.version>
<validation-api.version>2.0.1.Final</validation-api.version> <validation-api.version>2.0.1.Final</validation-api.version>
<derby.version>10.13.1.1</derby.version>
<hsqldb.version>2.3.4</hsqldb.version>
</properties> </properties>
</project> </project>

View File

@ -20,6 +20,9 @@ import java.util.Properties;
@Configuration @Configuration
@EnableJpaRepositories(basePackages = { "com.baeldung.boot.repository", "com.baeldung.repository" }) @EnableJpaRepositories(basePackages = { "com.baeldung.boot.repository", "com.baeldung.repository" })
@PropertySource("classpath:persistence-generic-entity.properties") @PropertySource("classpath:persistence-generic-entity.properties")
//@PropertySource("classpath:persistence-derby.properties")
//@PropertySource("classpath:persistence-hsqldb.properties")
//@PropertySource("classpath:persistence-sqlite.properties")
@EnableTransactionManagement @EnableTransactionManagement
@Profile("default") //only required to allow H2JpaConfig and H2TestProfileJPAConfig to coexist in same project @Profile("default") //only required to allow H2JpaConfig and H2TestProfileJPAConfig to coexist in same project
//this demo project is showcasing several ways to achieve the same end, and class-level //this demo project is showcasing several ways to achieve the same end, and class-level

View File

@ -0,0 +1,8 @@
jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
jdbc.url=jdbc:derby:memory:myD;create=true
jdbc.user=sa
jdbc.pass=
hibernate.dialect=org.hibernate.dialect.DerbyDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-drop

View File

@ -0,0 +1,8 @@
jdbc.driverClassName=org.hsqldb.jdbc.JDBCDriver
jdbc.url=jdbc:hsqldb:mem:myDb
jdbc.user=sa
jdbc.pass=
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-drop

View File

@ -0,0 +1,7 @@
jdbc.driverClassName=org.sqlite.JDBC
jdbc.url=jdbc:sqlite:memory:myDb?cache=shared
jdbc.user=sa
jdbc.pass=sa
hibernate.dialect=com.baeldung.dialect.SQLiteDialect
hibernate.hbm2ddl.auto=create-drop
hibernate.show_sql=true

View File

@ -17,7 +17,6 @@ To view the running application, visit [http://localhost:8080](http://localhost:
- [Guide to Spring Data REST Validators](http://www.baeldung.com/spring-data-rest-validators) - [Guide to Spring Data REST Validators](http://www.baeldung.com/spring-data-rest-validators)
- [Working with Relationships in Spring Data REST](http://www.baeldung.com/spring-data-rest-relationships) - [Working with Relationships in Spring Data REST](http://www.baeldung.com/spring-data-rest-relationships)
- [AngularJS CRUD Application with Spring Data REST](http://www.baeldung.com/angularjs-crud-with-spring-data-rest) - [AngularJS CRUD Application with Spring Data REST](http://www.baeldung.com/angularjs-crud-with-spring-data-rest)
- [List of In-Memory Databases](http://www.baeldung.com/java-in-memory-databases)
- [Projections and Excerpts in Spring Data REST](http://www.baeldung.com/spring-data-rest-projections-excerpts) - [Projections and Excerpts in Spring Data REST](http://www.baeldung.com/spring-data-rest-projections-excerpts)
- [Spring Data REST Events with @RepositoryEventHandler](http://www.baeldung.com/spring-data-rest-events) - [Spring Data REST Events with @RepositoryEventHandler](http://www.baeldung.com/spring-data-rest-events)
- [Customizing HTTP Endpoints in Spring Data REST](https://www.baeldung.com/spring-data-rest-customize-http-endpoints) - [Customizing HTTP Endpoints in Spring Data REST](https://www.baeldung.com/spring-data-rest-customize-http-endpoints)