[JAVA-8369] Split spring-data-jpa-query-2 module

This commit is contained in:
Haroon Khan 2022-01-11 08:43:33 +00:00
parent fa2b75a81c
commit 17449fa3de
12 changed files with 97 additions and 5 deletions

View File

@ -75,6 +75,7 @@
<module>spring-data-jpa-filtering</module>
<module>spring-data-jpa-query</module>
<module>spring-data-jpa-query-2</module>
<module>spring-data-jpa-query-3</module>
<module>spring-data-jpa-repo</module>
<module>spring-data-jpa-repo-2</module>
<module>spring-data-jdbc</module>

View File

@ -1,18 +1,17 @@
## Spring Data JPA - Query
This module contains articles about querying data using Spring Data JPA
This module contains articles about querying data using Spring Data JPA .
### Relevant Articles:
- [Spring Data JPA @Query](https://www.baeldung.com/spring-data-jpa-query)
- [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries)
- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date)
- [Hibernate Pagination](https://www.baeldung.com/hibernate-pagination)
- [Sorting with Hibernate](https://www.baeldung.com/hibernate-sort)
- [Stored Procedures with Hibernate](https://www.baeldung.com/stored-procedures-with-hibernate-tutorial)
- [Eager/Lazy Loading In Hibernate](https://www.baeldung.com/hibernate-lazy-eager-loading)
- [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa)
- More articles: [[<-- prev]](../spring-data-jpa-query)
- More articles: [[<-- prev]](../spring-data-jpa-query)[[more -->]](../spring-data-jpa-query-3)
### Eclipse Config
After importing the project into Eclipse, you may see the following error:

View File

@ -0,0 +1,16 @@
## Spring Data JPA - Query
This module contains articles about querying data using Spring Data JPA.
### Relevant Articles:
- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date)
- More articles: [[<-- prev]](../spring-data-jpa-query-2)
### 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

View File

@ -0,0 +1,32 @@
<?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-query-3</artifactId>
<name>spring-data-jpa-query-3</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-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,13 @@
package com.baeldung.spring.data.jpa.query;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class QueryApplication {
public static void main(String[] args) {
SpringApplication.run(QueryApplication.class, args);
}
}

View File

@ -9,10 +9,13 @@ public class Article {
@Id
@GeneratedValue
private Integer id;
@Temporal(TemporalType.DATE)
private Date publicationDate;
@Temporal(TemporalType.TIME)
private Date publicationTime;
@Temporal(TemporalType.TIMESTAMP)
private Date creationDateTime;

View File

@ -0,0 +1 @@
spring.jpa.defer-datasource-initialization=true

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<logger name="org.springframework" level="WARN" />
<logger name="org.springframework.transaction" level="WARN" />
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,8 @@
jdbc.driverClassName=org.h2.Driver
jdbc.url=jdbc:h2:mem:test
jdbc.user=sa
jdbc.pass=
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop