
Explore how orm, jpa, and spring data with hibernate simplify building a data access layer. Master crud, jpql, paging, sorting, associations, cascading, and transactions, culminating in patient appointment scheduling project.
Learn how this Spring Data JPA using Hibernate course is organized with sectioned hands-on lectures, quizzes, and assignments that cover the data access layer with Spring Data JPA and Hibernate.
Install the latest JDK, download and install Spring Tool Suite four for eclipse, and configure Spring Tool Suite to point to the JDK home directory to use Java SE runtime.
Install mysql and mysql workbench, then configure the root password and startup service; follow three steps—download the installer, install mysql and workbench, and configure mysql on port 3306.
Open MySQL Workbench, connect to the local MySQL server, and test the connection. Create a database named mydb using the query window and run the create database command.
Install mysql community server on Windows, covering prerequisites like Visual C++ and choosing server-only options; set a root password, use port 3306, and note encryption and JDBC compatibility.
Install MySQL Workbench guides you through downloading and installing the MySQL Workbench GUI client, launching it, connecting to local and remote MySQL servers, and creating databases in the query window.
Explore the official Spring Data JPA reference documentation and Spring Boot properties to configure data sources and Hibernate in Spring projects using the application.properties file.
Download completed projects and assignments from the resources section, unzip the file, and import maven projects (customer data assignment, patient scheduling mini project) into your IDE to build from scratch.
Clone the course repository from the GitHub URL at github.com/bharaththippireddy to access all completed projects, run them, reference them, and explore for your learning.
Delete the repository in the .m2 folder, then update the project to re-fetch dependencies and sync the Maven project.
Update Spring Data JPA projects to version 2.2.5, the latest release as of June 2020, with few API changes explained later, ensuring compatibility with Spring Boot.
Master the Java EE application layers, focusing on the data access layer's database operations, then routing data through the service, presentation, and integration layers, using Spring Data.
Learn how ORM maps a Java class to a database table and its fields to columns, enabling object-oriented developers to save, update, and delete objects without writing sql.
Understand JPA, the Java Persistence API, a standard for object-relational mapping in Java EE. See how Hibernate, OpenJPA, and EclipseLink implement the API, letting you switch providers without code changes.
Spring data eliminates boilerplate in data access by using a repository interface that extends CRUD operations, with runtime implementations and JPQL or native queries using JPA and Hibernate.
Model a product entity and map it with JPA annotations in a spring data project. Create a repository for crud operations, configure data source in properties, and test with JUnit.
Create the product table in MySQL using a SQL file, with id as primary key and fields name, description, and price, to support future CRUD with Spring Data JPA.
Create a spring boot project in STS, add JPA and MySQL dependencies, configure pom.xml to enable Spring Data JPA and Hibernate for CRUD operations on the product table.
Upgrading the course to the latest Spring Boot, from 1.4.x to 2.x, and learning the updated Spring Data JPA with Hibernate, including the few method differences.
Create a product entity mapped to the product table using JPA annotations such as entity, table, id, and column, and map the desc field to the description column.
Create a product repository interface that extends CrudRepository with Product as the entity type and int as the id type, placed in the repos package.
Configure the data source in Spring Boot by editing application.properties to set the JDBC URL, username, and password, enabling a MySQL connection on localhost:3306 with database mydb.
Test a Spring Data project with Spring Boot test and JUnit by running the generated test class to verify Hibernate configuration, database connections, and dependency injection.
Create a product entity, save it via the product repository, and observe Spring Data and Hibernate ORM handling the persistence in a JUnit test.
Discover how to enable show-sql in Spring Data JPA with Hibernate to reveal generated insert, select, and update statements in the console by configuring spring.jpa.show-sql in application.properties.
Demonstrate the read operation in Spring Data JPA by using find by id to retrieve an optional product, unwrap it, and assert name and description in a JUnit test.
Fetch record by id, modify fields like price, then call repository.save to update the product. Detect the id and issue an update SQL, demonstrated in a JUnit test.
Learn to perform delete operations in Spring Data JPA using Hibernate, including delete by id, delete all, delete a list, and deleting by entity via tests.
Explain how Spring Boot loads the classpath, detects Spring Data JPA with Hibernate as the default ORM, connects to MySQL via the data source, and configures it through application.properties.
Use the repository's exists by id method to check if a record exists and delete it when the id is present, demonstrated with inserting, validating with select, and JUnit tests.
Use the repository count method (no parameters) to retrieve the total number of rows in a table, display it on the console, and verify results with a JUnit test.
Enable show sql in Spring Data JPA to log Hibernate sql statements; set spring.jpa.show-sql=true in application.properties, then run tests to see selects and updates using prepared statements.
Learn how id generators work in JPA and Hibernate, covering auto, identity, sequence, and table strategies, how each generates primary keys, and database support.
Create the employee table in a MySQL database by pasting the provided SQL into MySQL Workbench, running use mydb, and defining an id field and a name varchar.
Use STS to create a new spring starter project, name the artifact id generators, set the group com.bharath.spring.data.id.generators and the package com.bharath.spring.data.id.generator, then select JPA and MySQL and finish.
Create an employee entity with id and name fields using JPA annotations in spring data jpa. Generate getters and setters in STS and prepare for repository creation.
Create the employee repository by defining an interface that extends CrudRepository, with Employee as the entity and long as the ID type, and organize packages for entities and repositories.
Configure the data source to enable testing, copy all properties from the source application.properties to a new one, then prepare to persist an employee record into the database.
Inject the employee repository, save a new employee with id 123 and name John, and verify the insert creates a record with id 123 and John in a JUnit test.
Apply the identity generator type in hibernate to auto increment the id column, marking the id field with @Id and a generated value so the database supplies the primary key.
Create an id_gen sequence table with gen_name and gen_value to support the table type strategy, drop and recreate the employee table, and remove id auto increment for the table generator.
Configure a table-based id generation using @TableGenerator named employee_gen, specify the table and id/value columns, set allocationSize to 100, and apply GenerationType.TABLE with generator.
Create a custom random id generator by implementing Hibernate's identifier generator and overriding generate to return a random int as the entity id, to be configured in the next lecture.
Configure a custom random id generator in Hibernate, define a generic emp_id generator, and map it with generated value to produce random long IDs for the employee table.
Learn how Spring Data finder methods generate queries from method names, enabling you to load products by name, description, or price without writing SQL, with Hibernate ORM.
Explore how spring data finder methods translate simple java methods into sql queries, letting you retrieve data without writing select statements, after setting up sample records in a product table.
Create a finder method named findByName in a product repository using Spring Data, returning a list of products without sql or jpql, with a runtime select and automatic mapping.
Explore finder methods with multiple fields, such as name and description, using two parameters and the desc keyword in Spring Data JPA.
Learn to use comparison operators in Spring Data JPA to retrieve products with prices greater than a given value, creating find by price greater than methods and testing with JUnit.
Learn to use the contains keyword in Spring Data JPA repositories to search product descriptions, with a test for description contains 'Apple' that returns the product name 'Iwatch'.
Learn to use the between keyword in Spring Data JPA to find products priced between 500 and 2500, with tests confirming TV, washer, and dryer and excluding Iwatch.
Learn to use the like keyword for wildcard searches in Spring Data JPA, implementing repository.findByDescLike to query descriptions and return matching products such as washer and dryer.
Explore using the in keyword to filter records by multiple ids in spring data jpa with hibernate. Create a repository.findByIdsIn call with arrays.asList to fetch three products, excluding the dryer.
Explore how Spring Data enables paging and sorting via Pageable, PageRequest, Sort, and Order, extending paging and sorting repositories to fetch subsets without extra queries.
Learn to add pagination and sorting with spring data jpa by using page request dot off and sort dot by, replacing the old constructors and handling null for ascending directions.
Update your Spring Boot 3.0 api by extending both the crud repository and the paging and sorting repository to enable full paging, sorting, and crud methods.
Enable paging and sorting for the find all method in the product repository by extending paging and sorting repository, creating a page request, and testing with paging and sort options.
Learn to sort find all results by a single entity property using Spring Data JPA's sort object, with optional ascending or descending direction.
Learn to sort by multiple properties in Spring Data JPA with Hibernate, using an overloaded sort constructor to order by name descending and then by price.
Learn to sort by multiple properties with orders in Spring Data JPA, using the sort object and its order class to specify directions such as name desc and price asc.
Combine paging and sorting using a repository to fetch sorted pages. Create page requests with page number, size, and name-based descending sort, then verify results with a test.
Explore how to add paging and sorting to custom finder methods by passing a pagable parameter, enabling page requests and tests to verify behavior in Spring Data JPA.
Learn how JPQL queries target domain classes and fields, not tables, with Hibernate converting them to SQL. Use named parameters and perform select, insert, update, and delete operations.
Create the student table in the mydb database with an auto-increment primary key id, last name, first name, and test scores, prepping JPQL and Spring support usage.
Create a new spring data project in STS, configure JPQL and native SQL queries, and set up JPA and MySQL dependencies with application properties for JDBC URL and show SQL.
Create a JPA entity named student to map the student table, with id, first name, last name, and score, including getters, setters, and a toString, using column mappings.
Create a student repository by implementing a Spring Data crud repository, naming it in JPQL and native SQL repos, with generic type T replaced by student and ID as long.
Add data by creating and saving two student records through a test, injecting the repository, and running the JUnit test to produce four records for upcoming JPQL queries.
Define a repository method to find all students using JPQL, annotate with @Query, and test it to return all student entities from the student JPA entity.
Learn to fetch partial data with JPQL by selecting first name and last name, returning a list of object arrays, and iterating to display each student's partial fields.
Learn how to use named parameters in JPQL statements, prefixed by a colon, bind them with a parameter annotation, and retrieve all students by a given first name.
Learn to query students by score range in spring data jpa with hibernate, using jpql and named parameters min and max, and test results with junit.
Explore non-select operations in JPQL by deleting students by first name with a repository method using @Query and @Param. Learn about @Modifying and transactional test behavior.
Add paging to a repository method by introducing a pageable parameter and passing a page request to fetch paged student records, with zero-based pages and configurable size.
Learn to sort records with Spring Data JPA using page request and sort objects, choosing ascending or descending order on fields like id and name, and understand paging behavior.
Sample of the reviews:
highly recommended, usually the courses of Professor Bharath are characterized by their extensive explanation in the examples which he himself is writing the code and explaining in detail, you will learn a lot about this subject and enjoy it if you are passionate about Spring and its related topics - Edilberto Ramos Salinas
Good course and clearly explained all topics. - Italo Diego Honorato Soto
A very good course with a very good content which is very well explained - Sergey Kargopolov
---
All source code is available for download
Responsive Instructor - All questions answered within 24 hours
Professional video and audio recordings (check the free previews)
---
Are you a java spring developer interested in mastering Springs powerful and easy to use ORM framework? Are you a java developer who want to create complete data access layer in two simple steps ? then this Spring Data JPA using Hibernate course is for you. It is a complete hand's on course with quizzes, assignments and a mini project at the end.
Spring data JPA removes all the boiler plate coding that we write to create Data Access Layer for our applications while using JPA and ORM tools like Hibernate. And with the power of spring boot there is zero xml or java based configuration required.
Hibernate is the most popular object-relational mapping framework and the most used JPA providers. Hibernate maps our java classes to database tables. It offers component mapping,inheritance mapping and supports various associations among objects.
Spring data JPA makes it super easy to use there powerful features of Hibernate by removing all the configuration and use of low level APIs. Spring Data makes it possible to remove the DAO implementations entirely – the interface of the DAO is now the only artifact that needs to be explicitly defined.
Every section in the course is loaded with hands on examples. You will also work on assignments at the end of each section. You will also work on a mini project at the end of the course.
After taking this class, developers will be able to build faster, more flexible and easier to maintain application persistence layers with Spring Data JPA Using Hibernate.
What Will I Learn?
Master the concepts of ORM,Spring Data JPA and Hibernate
Perform CRUD operations against a database with two simple steps
Configure auto generated IDs for the Primary Key fields
Realize the power of Spring Data Finder methods
Load data from database with with out implementing any code or SQL
Learn and use JPQL - Java Persistence Query Language
Execute native sql queries from your Spring Data Application
Use Paging and Sorting Learn the different types of Hibernate Mappings
Implement Component Mapping
Implement Inheritance Mapping Master Associations and use all the four types of associations
See Hibernate caching in action
Learn and manage Transactions
Work on a mini Patient Scheduling application