Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspar@viasoft.com.br authored and gaspar@viasoft.com.br committed Dec 8, 2020
2 parents c088feb + 33fec93 commit 7ffcf1c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ The file that contains the SQL query is a Jtwig template, where we can apply val

By default native query files must be added to a folder named "nativeQuery" inside the resource folder. Remember, the file name must be the same as the method name.

**in version 1.0.28 above we started using Hibernate Types to correctly convert data types, for previous versions consider disabling the use of Hibernate Types by the configuration below.**

```
native-query.use-hibernate-types=false
```

# Example

Here are some examples for a better understanding. Let's create a Spring Boot project with dependence, Spring Data Jpa and the H2 database. When starting the project, let's create a sql script by creating a new table and inserting some records. All sample source code is in [github](https://github.com/gasparbarancelli/demo-spring-native-query).
Expand All @@ -27,7 +33,7 @@ In your project add the dependency of the library, let's take an example using m
<dependency>
<groupId>io.github.gasparbarancelli</groupId>
<artifactId>spring-native-query</artifactId>
<version>1.0.25</version>
<version>1.0.28</version>
</dependency>
```

Expand Down Expand Up @@ -60,6 +66,7 @@ If you use properties file
``` properties
native-query.package-scan=io.github.gasparbarancelli.demospringnativequery
native-query.file.sufix=sql
native-query.use-hibernate-types=false
```
If you use yml file

Expand All @@ -68,6 +75,7 @@ native-query:
package-scan: io.github.gasparbarancelli.demospringnativequery
file:
sufix: sql
use-hibernate-types: false
```
We can also define programatically implementing the interface NativeQueryConfig.
Expand All @@ -86,6 +94,11 @@ public class NativeQueryDefaultConfig implements NativeQueryConfig {
public String getFileSufix() {
return "sql";
}

@Override
public boolean getUseHibernateTypes() {
return false;
}

}
```
Expand Down

0 comments on commit 7ffcf1c

Please sign in to comment.