Hibernate and JPA can both execute native SQL statements against a Database. In this tutorial we will learn how to map SQL native queries in Spring Boot applications.
This tutorial covers how to use MapStruct library to map automatically your Data Transfer Objects with your repository data, which in this example is managed by the JPA layer of a Spring Boot application.
Spring boot auto-configuration does not require a dedicated logging configuration file. So, in order to debug your SQL Statements in Spring Boot applications, by default can use the following settings in your application.properties file: logging.level.org.hibernate.SQL=DEBUG logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE When this configuration is added, you will be able to see: 1) Each SQL Statement executed 2) The timing … Read more
This tutorial will help you to solve the error Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified in your Spring Boot applications.
GraphQL is a specialized query language which gives us an alternative a more flexible approach to managing data in our application than restful design. In this tutorial we will learn how to use GraphQL with a Spring Boot application.
In order to have some data inserted at application start up, all you have to do is creating a data.sql file in your src/main/resources folder and it will be automatically executed on startup. Within this file, place your SQL INSERT Statements: INSERT into CUSTOMER(id,name,surname) VALUES (1,’aaaa’,’bbbbbb’) INSERT into CUSTOMER(id,name,surname) VALUES (2,’cccc’,’dddddd’) On the other hand, … Read more
In this tutorial we will learn how to create a basic CRUD Spring Boot application that uses PostgreSQL as database. We will be using Spring Boot CLI, then we will import the application into an IDE to create the full CRUD application.
Here is a sample application.properties configuration that will let Hibernate create the Database tables out of your Entity beans: spring.datasource.url=jdbc:mysql://localhost:3306/mysqltutorial?useSSL=false spring.datasource.username=root spring.datasource.password= spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto = create Here are the possible values for hibernate.hbm2ddl.auto : validate: validate the schema, makes no changes to the database. update: update the schema. create: creates the … Read more
The key to define a Mock Repository is the @Repository annotation. @Repository is a Spring annotation that indicates that the decorated class is a repository.
You can create a Spring Boot application using Groovy either from the IDE or using the online Spring Boot application generator http://start.spring.io and selecting Groovy as the language. You’ll now see how to develop a simple Spring Boot web application using Groovy, Spring Data JPA, and Thymeleaf. Add the Web, Thymeleaf, JPA, and H2 starters … Read more