Frameworks

Derived Query Methods

A derived query method is a method you declare in a Spring Data repository interface, where Spring reads the method name and generates the SQL query for you. You write only the method signature, such as List<Student> findByDepartment(String department);, with no SQL and no method body. Spring splits the name into parts: the action (findBy), […]

Derived Query Methods Read More »

JPA Repository

JPA Repository is a Spring Data JPA feature that provides ready-made database operations for JPA entities without requiring developers to write boilerplate SQL, JDBC connection, or EntityManager code. By extending JpaRepository, a repository interface automatically receives methods for common CRUD operations such as saving, retrieving, updating, and deleting records. Spring Data JPA creates the required

JPA Repository Read More »

Entity Mapping

Entity Mapping is the process of mapping Java classes and their fields to relational database tables and columns using JPA annotations. A Java class is marked as an entity using @Entity, while @Table can be used to specify the database table name. The @Id annotation identifies the primary key, and @GeneratedValue can be used to

Entity Mapping Read More »

JPA and Hibernate

JPA (Java Persistence API) is a standard specification in Java that provides a simple way to map Java objects to relational database tables using Object-Relational Mapping (ORM). Instead of writing SQL queries manually as in JDBC, developers can work with Java classes and objects, while JPA handles the conversion between objects and database records. Hibernate

JPA and Hibernate Read More »

Spring Data JPA

DatabaseMetaData is a JDBC interface used to obtain information about the database, JDBC driver, tables, columns, and supported database features. It is obtained from a Connection object using the getMetaData() method. Using DatabaseMetaData, a Java program can dynamically inspect database information without directly querying system tables. This is useful for database administration, debugging, database migration

Spring Data JPA Read More »

Multiple Database Support

Multiple database support means one Spring Boot application can run on different relational databases (H2, MySQL, PostgreSQL) without changing its Java code. Spring Boot picks the database from configuration: the driver on the classpath, the spring.datasource.* settings, and the active profile. Each database has its own settings file (application-h2.yml, application-mysql.yml, application-postgres.yml), and you switch between

Multiple Database Support Read More »

Row Mapping

A database query returns rows of columns, but your Java code works with objects like Student. Row mapping is the step that converts each row into an object. In JdbcTemplate, a RowMapper does this: Spring runs the query, calls your mapper once per row, and collects the objects into a List. It is used so

Row Mapping Read More »

JdbcTemplate

JdbcTemplate is Spring’s helper class for running SQL through JDBC. It opens and closes connections, prepares statements, loops through result sets, and handles exceptions for you. Traditional JDBC needs about 15 lines (connection, statement, result set, try/catch/finally) for one query. With JdbcTemplate it is one line: jdbcTemplate.query(sql, rowMapper, args). It also turns checked SQLExceptions into

JdbcTemplate Read More »

Working with Postgres Database Access with Spring Boot

Working With Postgres Database Access refers to integrating and managing access to a PostgreSQL relational database within a Spring Boot application. PostgreSQL is known for its strong SQL standards compliance, robust extensibility, and advanced features (such as JSON/JSONB support and full-text search). Spring Boot provides seamless support for PostgreSQL through managed connection pooling, simplified query

Working with Postgres Database Access with Spring Boot Read More »

Response Handling

Response handling is how your API answers a client: the JSON body, the HTTP status code (200, 201, 404 and so on), and the headers. Spring Boot converts a returned Java object into JSON automatically, and ResponseEntity lets you control the status code and headers as well. It is used so clients can tell success

Response Handling Read More »

Scroll to Top