JAVA-8292 : Split or move spring-data-jpa-enterprise module
This commit is contained in:
		
							parent
							
								
									c81fe2f74e
								
							
						
					
					
						commit
						ba226f327b
					
				
							
								
								
									
										18
									
								
								persistence-modules/spring-data-jpa-enterprise-2/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								persistence-modules/spring-data-jpa-enterprise-2/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | ## Spring Data JPA - Enterprise | ||||||
|  | 
 | ||||||
|  | This module contains articles about Spring Data JPA used in enterprise applications such as transactions, sessions, naming conventions and more  | ||||||
|  | 
 | ||||||
|  | ### Relevant Articles:  | ||||||
|  | 
 | ||||||
|  | - [Spring JPA – Multiple Databases](https://www.baeldung.com/spring-data-jpa-multiple-databases) | ||||||
|  | - [Pagination and Sorting using Spring Data JPA](https://www.baeldung.com/spring-data-jpa-pagination-sorting) | ||||||
|  | 
 | ||||||
|  | ### Eclipse Config  | ||||||
|  | After importing the project into Eclipse, you may see the following error:   | ||||||
|  | "No persistence xml file found in project" | ||||||
|  | 
 | ||||||
|  | This can be ignored:  | ||||||
|  | - Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" | ||||||
|  | Or:  | ||||||
|  | - Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator  | ||||||
|  | 
 | ||||||
							
								
								
									
										58
									
								
								persistence-modules/spring-data-jpa-enterprise-2/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								persistence-modules/spring-data-jpa-enterprise-2/pom.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,58 @@ | |||||||
|  | <?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"> | ||||||
|  |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |     <artifactId>spring-data-jpa-enterprise-2</artifactId> | ||||||
|  |     <name>spring-data-jpa-enterprise-2</name> | ||||||
|  | 
 | ||||||
|  |     <parent> | ||||||
|  |         <groupId>com.baeldung</groupId> | ||||||
|  |         <artifactId>parent-boot-2</artifactId> | ||||||
|  |         <version>0.0.1-SNAPSHOT</version> | ||||||
|  |         <relativePath>../../parent-boot-2</relativePath> | ||||||
|  |     </parent> | ||||||
|  | 
 | ||||||
|  |     <dependencies> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-starter-web</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-starter-data-jpa</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-starter-data-jdbc</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-starter-cache</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.h2database</groupId> | ||||||
|  |             <artifactId>h2</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.google.guava</groupId> | ||||||
|  |             <artifactId>guava</artifactId> | ||||||
|  |             <version>${guava.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |     </dependencies> | ||||||
|  | 
 | ||||||
|  |     <build> | ||||||
|  |         <sourceDirectory>src/main/java</sourceDirectory> | ||||||
|  |         <plugins> | ||||||
|  |             <plugin> | ||||||
|  |                 <artifactId>maven-compiler-plugin</artifactId> | ||||||
|  |                 <version>${maven-compiler-plugin.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <source>1.8</source> | ||||||
|  |                     <target>1.8</target> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  |         </plugins> | ||||||
|  |     </build> | ||||||
|  | 
 | ||||||
|  | </project> | ||||||
| @ -0,0 +1,13 @@ | |||||||
|  | package com.baeldung; | ||||||
|  | 
 | ||||||
|  | import org.springframework.boot.SpringApplication; | ||||||
|  | import org.springframework.boot.autoconfigure.SpringBootApplication; | ||||||
|  | 
 | ||||||
|  | @SpringBootApplication | ||||||
|  | public class Application { | ||||||
|  | 
 | ||||||
|  |     public static void main(String[] args) { | ||||||
|  |         SpringApplication.run(Application.class, args); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||||
| import org.springframework.boot.context.properties.ConfigurationProperties; | import org.springframework.boot.context.properties.ConfigurationProperties; | ||||||
| import org.springframework.boot.jdbc.DataSourceBuilder; | import org.springframework.boot.jdbc.DataSourceBuilder; | ||||||
| import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||||
| import org.springframework.context.annotation.Configuration; |  | ||||||
| import org.springframework.context.annotation.Profile; | import org.springframework.context.annotation.Profile; | ||||||
| import org.springframework.context.annotation.PropertySource; | import org.springframework.context.annotation.PropertySource; | ||||||
| import org.springframework.core.env.Environment; | import org.springframework.core.env.Environment; | ||||||
| @ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||||
| import org.springframework.boot.context.properties.ConfigurationProperties; | import org.springframework.boot.context.properties.ConfigurationProperties; | ||||||
| import org.springframework.boot.jdbc.DataSourceBuilder; | import org.springframework.boot.jdbc.DataSourceBuilder; | ||||||
| import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||||
| import org.springframework.context.annotation.Configuration; |  | ||||||
| import org.springframework.context.annotation.Primary; | import org.springframework.context.annotation.Primary; | ||||||
| import org.springframework.context.annotation.Profile; | import org.springframework.context.annotation.Profile; | ||||||
| import org.springframework.context.annotation.PropertySource; | import org.springframework.context.annotation.PropertySource; | ||||||
| @ -0,0 +1,15 @@ | |||||||
|  | 
 | ||||||
|  | spring.datasource.url=jdbc:h2:mem:baeldung | ||||||
|  | 
 | ||||||
|  | # JPA-Schema-Generation | ||||||
|  | # Use below configuration to generate database schema create commands based on the entity models | ||||||
|  | # and export them into the create.sql file | ||||||
|  | #spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create | ||||||
|  | #spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql | ||||||
|  | #spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata | ||||||
|  | #spring.jpa.properties.hibernate.format_sql=true | ||||||
|  | 
 | ||||||
|  | spring.jpa.show-sql=false | ||||||
|  | 
 | ||||||
|  | #hibernate.dialect=org.hibernate.dialect.H2Dialect | ||||||
|  | spring.jpa.properties.hibernate.id.new_generator_mappings=false | ||||||
| @ -18,12 +18,10 @@ import org.springframework.data.domain.Page; | |||||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||||
| import org.springframework.data.domain.Pageable; | import org.springframework.data.domain.Pageable; | ||||||
| import org.springframework.data.domain.Sort; | import org.springframework.data.domain.Sort; | ||||||
| import org.springframework.test.context.ContextConfiguration; |  | ||||||
| import org.springframework.test.context.junit4.SpringRunner; | import org.springframework.test.context.junit4.SpringRunner; | ||||||
| import org.springframework.transaction.annotation.EnableTransactionManagement; | import org.springframework.transaction.annotation.EnableTransactionManagement; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
| 
 | 
 | ||||||
| import com.baeldung.multipledb.PersistenceProductConfiguration; |  | ||||||
| import com.baeldung.multipledb.dao.product.ProductRepository; | import com.baeldung.multipledb.dao.product.ProductRepository; | ||||||
| import com.baeldung.multipledb.model.product.Product; | import com.baeldung.multipledb.model.product.Product; | ||||||
| 
 | 
 | ||||||
| @ -0,0 +1,13 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <configuration scan="true" scanPeriod="15 seconds" debug="false"> | ||||||
|  |     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||||||
|  |         <encoder> | ||||||
|  |             <pattern>[%d{ISO8601}]-[%thread] %-5level %logger - %msg%n</pattern> | ||||||
|  |         </encoder> | ||||||
|  |     </appender> | ||||||
|  | 
 | ||||||
|  |     <root level="INFO"> | ||||||
|  |         <appender-ref ref="STDOUT" /> | ||||||
|  |     </root> | ||||||
|  |     <logger name="org.hibernate" level="INFO"/> | ||||||
|  | </configuration> | ||||||
| @ -4,9 +4,7 @@ This module contains articles about Spring Data JPA used in enterprise applicati | |||||||
| 
 | 
 | ||||||
| ### Relevant Articles:  | ### Relevant Articles:  | ||||||
| 
 | 
 | ||||||
| - [Spring JPA – Multiple Databases](https://www.baeldung.com/spring-data-jpa-multiple-databases) |  | ||||||
| - [Spring Data Java 8 Support](https://www.baeldung.com/spring-data-java-8) | - [Spring Data Java 8 Support](https://www.baeldung.com/spring-data-java-8) | ||||||
| - [Pagination and Sorting using Spring Data JPA](https://www.baeldung.com/spring-data-jpa-pagination-sorting) |  | ||||||
| - [DB Integration Tests with Spring Boot and Testcontainers](https://www.baeldung.com/spring-boot-testcontainers-integration-test) | - [DB Integration Tests with Spring Boot and Testcontainers](https://www.baeldung.com/spring-boot-testcontainers-integration-test) | ||||||
| - [A Guide to Spring’s Open Session In View](https://www.baeldung.com/spring-open-session-in-view) | - [A Guide to Spring’s Open Session In View](https://www.baeldung.com/spring-open-session-in-view) | ||||||
| - [Working with Lazy Element Collections in JPA](https://www.baeldung.com/java-jpa-lazy-collections) | - [Working with Lazy Element Collections in JPA](https://www.baeldung.com/java-jpa-lazy-collections) | ||||||
|  | |||||||
| @ -8,14 +8,10 @@ import org.springframework.test.context.junit4.SpringRunner; | |||||||
| 
 | 
 | ||||||
| import com.baeldung.boot.Application; | import com.baeldung.boot.Application; | ||||||
| import com.baeldung.boot.config.PersistenceConfiguration; | import com.baeldung.boot.config.PersistenceConfiguration; | ||||||
| import com.baeldung.multipledb.PersistenceProductConfiguration; |  | ||||||
| import com.baeldung.multipledb.PersistenceUserConfiguration; |  | ||||||
| 
 | 
 | ||||||
| @RunWith(SpringRunner.class) | @RunWith(SpringRunner.class) | ||||||
| @DataJpaTest(excludeAutoConfiguration = { | @DataJpaTest(excludeAutoConfiguration = { | ||||||
|         PersistenceConfiguration.class, |         PersistenceConfiguration.class }) | ||||||
|         PersistenceUserConfiguration.class, |  | ||||||
|         PersistenceProductConfiguration.class }) |  | ||||||
| @ContextConfiguration(classes = Application.class) | @ContextConfiguration(classes = Application.class) | ||||||
| public class SpringJpaContextIntegrationTest { | public class SpringJpaContextIntegrationTest { | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user