Filter
Exclude
Time range
-
Near
πŸ“š Learning Notes: Why Refresh Tokens Should Be Persisted While learning JWT authentication, I came across an interesting question: πŸ€” If JWTs are stateless, why would we store refresh tokens in a database? The answer comes down to one thing: πŸ” Control. πŸ”Ή The Problem Access tokens are usually short-lived. ⏱️ 15 minutes ⏱️ 30 minutes ⏱️ 1 hour If an access token is stolen, the damage is limited. Refresh tokens are different. They often live for months or even a year. If a refresh token is compromised, an attacker could continuously generate new access tokens. That's a much bigger risk. πŸ”Ή Why Persist Refresh Tokens? Instead of treating refresh tokens as completely stateless, many systems store metadata about them. Benefits: βœ… Token Revocation Logout becomes meaningful. Delete the refresh token record and the token can no longer be used. βœ… Device Management Track how many active sessions a user has. Example: β€’ Laptop β€’ Mobile β€’ Tablet Each device can have its own refresh token record. βœ… Suspicious Activity Detection Unexpected token usage can be identified and revoked. βœ… Token Rotation Each refresh token can be used exactly once. When exchanged: Old Token ❌ New Token βœ… This dramatically reduces the value of stolen refresh tokens. πŸ”Ή TDD Approach Following the Red β†’ Green β†’ Refactor cycle: πŸ”΄ Red Write a failing test: β€’ Register a user β€’ Check if a refresh token record exists in the database The test fails because no persistence mechanism exists yet. 🟒 Green Create a RefreshToken entity: RefreshToken β”œβ”€ id β”œβ”€ expiresAt β”œβ”€ userId β”œβ”€ createdAt └─ updatedAt Save a refresh token record whenever a user authenticates. Run tests again β†’ Pass βœ… πŸ”Ή User ↔ Refresh Token Relationship A common design: User (1) β”‚ β”‚ β–Ό Refresh Tokens (Many) This allows a single user to maintain multiple active sessions across devices. TypeORM makes this easy using: β€’ OneToMany β€’ ManyToOne relationships. πŸ”Ή JWT ID (JTI) One concept I found particularly interesting was using the JWT ID claim. Instead of storing large amounts of data inside the refresh token: JWT β”œβ”€ sub β”œβ”€ role └─ jti The jti references the database record. Benefits: βœ… Smaller tokens βœ… Easy revocation βœ… Better auditing βœ… Simpler token rotation πŸ”Ή Additional Security Opportunities Once refresh tokens are persisted, we unlock features such as: πŸ›‘οΈ Logout Everywhere πŸ›‘οΈ Session Tracking πŸ›‘οΈ Refresh Token Rotation πŸ›‘οΈ Revocation Lists πŸ›‘οΈ Expired Token Cleanup Jobs These become difficult or impossible with fully stateless refresh tokens. πŸ’‘ Biggest takeaway JWT authentication is often described as stateless. But in practice, many production systems intentionally add state back to refresh tokens. Why? Because security isn't just about issuing tokens. It's about being able to control them after they've been issued. #JWT #Authentication #RefreshToken #NodeJS #TypeScript #BackendDevelopment #SoftwareEngineering #WebSecurity #LearningInPublic #PostgreSQL #TypeORM
πŸ“š Day 3 of Building a Microservices-Based Project Over the past few days, I've been working on the Authentication Service and learning more about how authentication and session management are handled in backend systems. Today's focus was on stateless vs stateful authentication, JWTs, Access Tokens, Refresh Tokens, and token persistence. Some of the things I explored: πŸ”Ή Understanding the difference between stateless and stateful authentication πŸ”Ή Learning how JWT-based authentication enables stateless authorization πŸ”Ή Understanding the difference between Access Tokens and Refresh Tokens πŸ”Ή Generating JWTs and storing them securely in cookies πŸ”Ή Creating a dedicated Refresh Token entity in PostgreSQL using TypeORM πŸ”Ή Persisting refresh tokens in the database instead of relying solely on stateless JWTs πŸ”Ή Learning how JWT IDs can be be used to link tokens with database records πŸ”Ή Updating integration tests to verify refresh token persistence during user registration One thing I found particularly interesting was the distinction between stateless and stateful authentication. With stateless authentication, all the information needed to validate a user is contained within the token itself, allowing services to verify requests without querying a database. This can improve scalability and simplify distributed systems. With stateful authentication, session information is stored on the server side, making it easier to manage active sessions, revoke access, and enforce security policies. By storing refresh tokens in the database, we introduce a stateful component that enables features such as session management, token revocation, and token rotation. Another valuable lesson was seeing how quickly controllers can become overloaded with responsibilities and how moving logic into dedicated services makes the codebase easier to maintain and test. Still learning a lot about authentication, security, and microservice architecture, but each step is helping me better understand how production-ready systems are designed. @codersGyan #Microservices #BackendDevelopment #NodeJS #TypeScript #JWT #Authentication #PostgreSQL #TypeORM #SoftwareEngineering #LearningInPublic #WebDevelopment
31
Completed the Third Module by Coding Shuttle @sudoanuj which is based on the Relationship mapping between the tables, how JDBC and Spring Data JPA helps to map the POJO with the database. Learned Cascading and many other important concepts like pagination and projection. The homework assignment was heavily focused on the relationship mappings. The first homework assignment was related to subject, student, department, admission record and professor which is basically a college management system where the ERD diagram was provided by @sudoanuj which made things easier. The tables have different relationships with each other. Some tables have OneToOne relationship and some have ManyToMany. Let's Understand the annotations with examples: 1. OneToOne: A Student can have only one Admission record. So that's why a OneToOne relationship is established between these two tables. 2. OneToMany: A Professor can teach more than one subject. So there's a OneToMany relationship established between these two tables and vice versa for ManyToOne. 3. ManyToMany: Many students can be taught by many professors. mappedBy is used to define the non-owning (inverse) side of a bidirectional entity relationship. It is present on the inverse side of the relationship, telling JPA that the other side owns the foreign key. JsonIgnore is a Jackson library annotation used to prevent specific entity fields or relationships from being serialized into JSON. It is commonly used to hide sensitive data like passwords or to break infinite recursion loops caused by bidirectional database relationships. Heavily used in ManyToMany relationships. JoinTable with JoinColumn defines the owning side of a ManyToMany relationship in JPA. It explicitly defines the intermediate join table and the foreign key columns used to establish the relationship between two database tables. The second homework project was an Author and Book management system where we had to map authors and the books they published. There are only two tables in this project with a ManyToMany relationship between authors and books β€” because one author can write many books and one book can have many authors. The main challenge was implementing all these APIs: Create a new book and author Retrieve a list of all books and authors Retrieve a single book or author by ID Update book and author details Delete a book or author Find books by title Find books published after a certain date Find authors by name Find all books by a specific author Some APIs required custom query methods in the Repository layer using Spring Data JPA's method naming conventions. Definitely a solid project! Learned a lot in this module. Will dive more in-depth into topics like Cascading and N 1 query optimization. #Java #SpringBoot #SpringDataJPA #BackendDevelopment #LearningInPublic #JavaDeveloper #CodingJourney
1
2
114
Day 14 - Spring Boot Learned how database relationships work using OneToMany and ManyToOne mappings. Implemented a real-world example: User to Orders relationship using JPA & Hibernate. #SpringBoot #Java #BackendDevelopment
1
4
74
Daily Log πŸͺ΅ ​Spring Boot: Deep-dived into OneToMany and ManyToOne mappings; polished my understanding of Validation constraints. ​DSA: Tackled the "Lowest Common Ancestor" (Medium) in Binary Trees and knocked out 3 Linked List revisions. ​#SpringBoot #Java #DataStructures
7
55
The best way to map the ManyToOne association with JPA and Hibernate vladmihalcea.com/manytoone-j…
1
17
1,425
Early hours of today, my Spring Boot app crashed on startup with a Hibernate error: β€œProperty β€˜BudgetTemplate.user’ is not a collection and may not be a @OneToMany” At first glance it looks scary. But when you understand relationships, the fix is obvious in seconds. A BudgetTemplate belongs to one User,so from the template’s side, that’s @ManyToOne, not @OneToMany. One annotation change. App back up. Database connected. The lesson: errors stop being scary when you understand the β€œwhy” behind your design decisions ,not just the code. Still building. πŸš€ Gm!
1
4
71
Yesterday's update : Day 12 of Learning and improving : - Solved DSA Problem - Meditation - Learnt about OneToOne, ManyToOne, ManyToMany, OneToMany mapping in Spring - Learnt about Cascading in Spring JPA
4
8
126
Java Development Roadmap (Complete Guide) PHASE 1: JAVA FUNDAMENTALS β”œβ”€β”€ Core Java Basics β”‚ β”œβ”€β”€ JDK, JRE, JVM architecture β”‚ β”œβ”€β”€ Data types and variables β”‚ β”œβ”€β”€ Operators and expressions β”‚ β”œβ”€β”€ Control flow (if-else, switch, loops) β”‚ └── Arrays and enhanced for loops β”œβ”€β”€ Object-Oriented Programming β”‚ β”œβ”€β”€ Classes and objects β”‚ β”œβ”€β”€ Constructors and this keyword β”‚ β”œβ”€β”€ Inheritance (extends, super) β”‚ β”œβ”€β”€ Polymorphism (overloading, overriding) β”‚ β”œβ”€β”€ Abstraction (abstract classes, interfaces) β”‚ └── Encapsulation (access modifiers) β”œβ”€β”€ Basic Java APIs β”‚ β”œβ”€β”€ String, StringBuilder, StringBuffer β”‚ β”œβ”€β”€ Wrapper classes and autoboxing β”‚ β”œβ”€β”€ Math, Random, Scanner classes β”‚ └── Date and Time API (java.time) PHASE 2: ADVANCED JAVA β”œβ”€β”€ Collections Framework β”‚ β”œβ”€β”€ List (ArrayList, LinkedList, Vector) β”‚ β”œβ”€β”€ Set (HashSet, LinkedHashSet, TreeSet) β”‚ β”œβ”€β”€ Queue (PriorityQueue, ArrayDeque) β”‚ β”œβ”€β”€ Map (HashMap, LinkedHashMap, TreeMap) β”‚ β”œβ”€β”€ Comparable vs Comparator β”‚ └── Stream operations and lambda expressions β”œβ”€β”€ Exception Handling β”‚ β”œβ”€β”€ Checked vs unchecked exceptions β”‚ β”œβ”€β”€ try-catch-finally blocks β”‚ β”œβ”€β”€ try-with-resources β”‚ └── Custom exceptions β”œβ”€β”€ Multithreading β”‚ β”œβ”€β”€ Thread class and Runnable interface β”‚ β”œβ”€β”€ Thread lifecycle and states β”‚ β”œβ”€β”€ Synchronization and locks β”‚ β”œβ”€β”€ ExecutorService and thread pools β”‚ β”œβ”€β”€ CompletableFuture for async programming β”‚ └── Concurrent collections β”œβ”€β”€ File I/O and NIO β”‚ β”œβ”€β”€ FileReader/FileWriter β”‚ β”œβ”€β”€ BufferedReader/BufferedWriter β”‚ β”œβ”€β”€ NIO package (Path, Files) β”‚ └── Serialization PHASE 3: DATABASE & JDBC β”œβ”€β”€ SQL Fundamentals β”‚ β”œβ”€β”€ CRUD operations β”‚ β”œβ”€β”€ Joins (INNER, LEFT, RIGHT, FULL) β”‚ β”œβ”€β”€ Group By and Having β”‚ β”œβ”€β”€ Subqueries and set operations β”‚ └── Indexes and performance β”œβ”€β”€ JDBC Programming β”‚ β”œβ”€β”€ DriverManager and Connection β”‚ β”œβ”€β”€ Statement, PreparedStatement β”‚ β”œβ”€β”€ ResultSet and RowSet β”‚ β”œβ”€β”€ Batch processing β”‚ β”œβ”€β”€ Transaction management β”‚ └── Connection pooling (HikariCP) β”œβ”€β”€ Database Design β”‚ β”œβ”€β”€ Normalization (1NF to 3NF) β”‚ β”œβ”€β”€ Primary/Foreign keys β”‚ └── Entity relationship modeling PHASE 4: ENTERPRISE JAVA (JAKARTA EE) β”œβ”€β”€ Servlet & JSP β”‚ β”œβ”€β”€ Servlet lifecycle β”‚ β”œβ”€β”€ RequestDispatcher and sendRedirect β”‚ β”œβ”€β”€ Session management β”‚ β”œβ”€β”€ Filters and Listeners β”‚ β”œβ”€β”€ JSP tags and EL β”‚ └── MVC architecture with Servlets/JSP β”œβ”€β”€ RESTful Web Services β”‚ β”œβ”€β”€ JAX-RS (Jersey, RESTEasy) β”‚ β”œβ”€β”€ @Path, @GET, @POST annotations β”‚ β”œβ”€β”€ JSON binding with Jackson β”‚ β”œβ”€β”€ Exception mappers β”‚ └── API documentation (Swagger/OpenAPI) β”œβ”€β”€ Enterprise Integration β”‚ β”œβ”€β”€ JMS with ActiveMQ β”‚ β”œβ”€β”€ EJB basics (stateless, stateful) β”‚ └── JTA transactions PHASE 5: SPRING FRAMEWORK β”œβ”€β”€ Spring Core β”‚ β”œβ”€β”€ IoC and Dependency Injection β”‚ β”œβ”€β”€ ApplicationContext and BeanFactory β”‚ β”œβ”€β”€ XML vs Java configuration β”‚ β”œβ”€β”€ Annotations (@Component, @Autowired) β”‚ β”œβ”€β”€ Bean scopes and lifecycle β”‚ └── Spring Expression Language (SpEL) β”œβ”€β”€ Spring MVC β”‚ β”œβ”€β”€ DispatcherServlet workflow β”‚ β”œβ”€β”€ Controllers (@Controller, @RestController) β”‚ β”œβ”€β”€ Request mapping and data binding β”‚ β”œβ”€β”€ Validation with Hibernate Validator β”‚ β”œβ”€β”€ File upload/download β”‚ └── Interceptors and exception handling β”œβ”€β”€ Spring Data JPA β”‚ β”œβ”€β”€ Hibernate ORM fundamentals β”‚ β”œβ”€β”€ Entity mappings (@OneToMany, @ManyToOne) β”‚ β”œβ”€β”€ Repository pattern (JpaRepository) β”‚ β”œβ”€β”€ Query methods and @Query β”‚ β”œβ”€β”€ Pagination and sorting β”‚ └── Auditing and soft deletes β”œβ”€β”€ Spring Security β”‚ β”œβ”€β”€ Authentication and Authorization β”‚ β”œβ”€β”€ UserDetailsService and JWT β”‚ β”œβ”€β”€ OAuth2 and SSO integration β”‚ β”œβ”€β”€ Method-level security β”‚ └── CSRF and CORS configuration PHASE 6: SPRING BOOT & MICROSERVICES β”œβ”€β”€ Spring Boot Fundamentals β”‚ β”œβ”€β”€ Auto-configuration β”‚ β”œβ”€β”€ Starters and dependencies β”‚ β”œβ”€β”€ application.properties/yml β”‚ β”œβ”€β”€ Profiles and environment-specific config β”‚ β”œβ”€β”€ Actuator endpoints β”‚ └── Spring Boot DevTools β”œβ”€β”€ Microservices Architecture β”‚ β”œβ”€β”€ Spring Cloud ecosystem β”‚ β”œβ”€β”€ Service discovery (Eureka) β”‚ β”œβ”€β”€ API Gateway (Spring Cloud Gateway) β”‚ β”œβ”€β”€ Circuit breaker (Resilience4j) β”‚ β”œβ”€β”€ Distributed tracing (Sleuth Zipkin) β”‚ └── Configuration server (Spring Cloud Config) β”œβ”€β”€ Communication Protocols β”‚ β”œβ”€β”€ RESTful services with WebClient β”‚ β”œβ”€β”€ gRPC with Protocol Buffers β”‚ β”œβ”€β”€ Apache Kafka for event-driven architecture β”‚ └── RabbitMQ with Spring AMQP PHASE 7: BUILD TOOLS & TESTING β”œβ”€β”€ Build Tools β”‚ β”œβ”€β”€ Maven (POM.xml, dependencies, plugins) β”‚ β”‚ β”œβ”€β”€ Project structure β”‚ β”‚ β”œβ”€β”€ Lifecycle phases β”‚ β”‚ └── Multi-module projects β”‚ β”œβ”€β”€ Gradle (build.gradle, tasks) β”‚ β”‚ β”œβ”€β”€ Groovy vs Kotlin DSL β”‚ β”‚ └── Dependency management β”œβ”€β”€ Testing β”‚ β”œβ”€β”€ Unit Testing with JUnit 5 β”‚ β”‚ β”œβ”€β”€ @Test, assertions β”‚ β”‚ β”œβ”€β”€ Parameterized tests β”‚ β”‚ └── Test lifecycle hooks β”‚ β”œβ”€β”€ Mocking with Mockito β”‚ β”‚ β”œβ”€β”€ @Mock, @InjectMocks β”‚ β”‚ └── When/Then patterns β”‚ β”œβ”€β”€ Integration Testing β”‚ β”‚ β”œβ”€β”€ @SpringBootTest β”‚ β”‚ β”œβ”€β”€ TestContainers for database testing β”‚ β”‚ └── @DataJpaTest, @WebMvcTest β”‚ └── Performance Testing (JMeter, Gatling) PHASE 8: DEVOPS & DEPLOYMENT β”œβ”€β”€ Containerization β”‚ β”œβ”€β”€ Docker for Java apps β”‚ β”‚ β”œβ”€β”€ Multi-stage Dockerfiles β”‚ β”‚ β”œβ”€β”€ JVM optimization in containers β”‚ β”‚ └── Docker Compose for local dev β”‚ β”œβ”€β”€ Kubernetes for Java microservices β”‚ β”‚ β”œβ”€β”€ Pod and Service definitions β”‚ β”‚ β”œβ”€β”€ ConfigMaps and Secrets β”‚ β”‚ └── Helm charts for Java apps β”œβ”€β”€ CI/CD Pipeline β”‚ β”œβ”€β”€ Jenkins with Java projects β”‚ β”œβ”€β”€ GitHub Actions for Spring Boot β”‚ β”œβ”€β”€ GitLab CI with Maven/Gradle β”‚ └── SonarQube for code quality β”œβ”€β”€ Cloud Deployment β”‚ β”œβ”€β”€ AWS (Elastic Beanstalk, ECS, EKS) β”‚ β”œβ”€β”€ Azure (App Service, AKS) β”‚ β”œβ”€β”€ Google Cloud (App Engine, GKE) β”‚ └── Heroku / Railway / Render PHASE 9: PERFORMANCE & SECURITY β”œβ”€β”€ Performance Optimization β”‚ β”œβ”€β”€ JVM tuning (Heap, GC algorithms) β”‚ β”œβ”€β”€ Profiling tools (JProfiler, VisualVM) β”‚ β”œβ”€β”€ Database query optimization β”‚ β”œβ”€β”€ Caching (Spring Cache, Redis, Hazelcast) β”‚ └── Connection pooling tuning β”œβ”€β”€ Security Best Practices β”‚ β”œβ”€β”€ OWASP Top 10 for Java β”‚ β”œβ”€β”€ Input validation and sanitization β”‚ β”œβ”€β”€ SQL/NoSQL injection prevention β”‚ β”œβ”€β”€ Secure coding guidelines β”‚ β”œβ”€β”€ Dependency scanning (OWASP Dependency Check) β”‚ └── Secret management (Vault, AWS Secrets Manager) PHASE 10: MODERN JAVA & TRENDS β”œβ”€β”€ Java 8 Features β”‚ β”œβ”€β”€ Lambda expressions and Streams β”‚ β”œβ”€β”€ Optional class β”‚ β”œβ”€β”€ Default and static methods in interfaces β”‚ β”œβ”€β”€ New Date/Time API β”‚ └── CompletableFuture β”œβ”€β”€ Java 9-21 Features β”‚ β”œβ”€β”€ Module system (Project Jigsaw) β”‚ β”œβ”€β”€ Local variable type inference (var) β”‚ β”œβ”€β”€ Switch expressions β”‚ β”œβ”€β”€ Text blocks β”‚ β”œβ”€β”€ Records and sealed classes β”‚ β”œβ”€β”€ Pattern matching β”‚ β”œβ”€β”€ Virtual threads (Project Loom) β”‚ └── Foreign Function & Memory API β”œβ”€β”€ Reactive Programming β”‚ β”œβ”€β”€ Project Reactor (Mono, Flux) β”‚ β”œβ”€β”€ Spring WebFlux β”‚ └── RSocket protocol SPECIALIZED DOMAINS β”œβ”€β”€ Big Data Java β”‚ β”œβ”€β”€ Apache Spark with Java β”‚ β”œβ”€β”€ Apache Flink β”‚ └── Hadoop ecosystem β”œβ”€β”€ Android Development β”‚ β”œβ”€β”€ Android SDK with Java β”‚ └── Kotlin interop β”œβ”€β”€ FinTech/Enterprise β”‚ β”œβ”€β”€ High-performance Java β”‚ β”œβ”€β”€ Low-latency systems β”‚ └── Financial messaging (FIX protocol) PROJECTS TO BUILD 1. Beginner: Library Management System (Core Java File I/O) 2. Intermediate: E-commerce API (Spring Boot JPA Security) 3. Intermediate: Task Management App with JWT authentication 4. Advanced: Microservices-based Banking System (Spring Cloud, Kafka) 5. Advanced: Real-time Chat Application (WebSocket STOMP) 6. Expert: Stock Trading Platform (low-latency, reactive) 7. Expert: Scalable Social Media Backend (microservices, Redis) LEARNING RESOURCES β”œβ”€β”€ Official Documentation β”‚ β”œβ”€β”€ docs.oracle.com/en/java/ β”‚ β”œβ”€β”€ spring.io/projects/spring-bo… β”‚ └── hibernate.org/orm/documentat… β”œβ”€β”€ Books β”‚ β”œβ”€β”€ "Effective Java" - Joshua Bloch β”‚ β”œβ”€β”€ "Java Concurrency in Practice" β”‚ β”œβ”€β”€ "Spring in Action" β”‚ └── "Clean Code" - Robert C. Martin β”œβ”€β”€ Practice Platforms β”‚ β”œβ”€β”€ LeetCode (Java problems) β”‚ β”œβ”€β”€ HackerRank Java track β”‚ β”œβ”€β”€ CodeWars β”‚ └── Spring Initializr (start.spring.io) RECOMMENDED CERTIFICATIONS β”œβ”€β”€ Oracle Certified Professional: Java SE Programmer β”œβ”€β”€ Spring Professional Certification β”œβ”€β”€ AWS Certified Developer └── Azure Java Developer πŸ“š RECOMMENDED EBOOK For comprehensive Java and its interview preparation and in-depth concepts, check out: πŸ‘‰Grab the Java Handbook: codewithdhanian.gumroad.com/…)** This ebook covers: - Core Java fundamentals with detailed explanations - Advanced Java concepts (Multithreading, Collections) - Spring/Spring Boot interview questions - Microservices design patterns - Real-world scenarios and coding problems - 300 frequently asked interview questions - Code examples and best practices - System design for Java developers Estimated Time: 6-12 months for core proficiency, 1-2 years for enterprise readiness Key Principle: Write code daily, understand the "why" behind features, master debugging Progression Strategy: 1. Months 1-3: Core Java OOP concepts 2. Months 4-6: Advanced Java JDBC Basic Servlets 3. Months 7-12: Spring Framework Spring Boot 4. Year 2: Microservices Cloud Advanced topics 5. Year 3 : Specialization Architecture Java Developer Mindset: - Strong typing catches bugs early - JVM is your friend - understand it - Enterprise patterns matter - Backward compatibility is sacred - Verbose can be clear - prioritize readability - Always consider garbage collection and memory - Design for interfaces, not implementations Daily Learning Routine: - Morning: Read Java/Spring documentation or articles - Afternoon: Code implementation - Evening: Code review and optimization - Weekend: Build side projects and experiment Community to Follow: - r/java, r/springsource - Follow @e_opore on X - Java Champions on Twitter - Spring Blog - InfoQ Java section Remember: Java is everywhere - from Android phones to enterprise servers to big data systems. Master the fundamentals first, then explore specialized domains. The ecosystem is vast but well-documented. Build projects that solve real problems, and always keep learning as Java evolves every 6 months now!
9
118
622
20,895
Feb 18
The only Java Spring Boot concepts you need to know β€’ Spring Boot Setup β†’ @ SpringBootApplication, Spring Initializr β€’ Dependency Injection & IoC β†’ @ Autowired, Bean scopes β€’ Auto-configuration & Starters β†’ reduced boilerplate config β€’ REST API Basics β†’ @ RestController, @ GetMapping, @ PostMapping β€’ HTTP Methods & Routing β†’ @ PutMapping, @ DeleteMapping, @ RequestMapping β€’ Request Handling β†’ @ RequestBody, @ PathVariable, @ RequestParam β€’ Configuration β†’ application .properties, application.yml, Spring Profiles β€’ Spring Data JPA β†’ @ Entity, @ Table, @ Id β€’ Repositories β†’ JpaRepository, derived queries & @ Query β€’ Relationships β†’ @ OneToMany, @ ManyToOne, @ JoinColumn β€’ Validation β†’ @ Valid, @ NotNull, @ Size β€’ Exception Handling β†’ @ ControllerAdvice, @ ExceptionHandler β€’ Security Basics β†’ Spring Security setup, roles & permissions β€’ JWT Authentication β†’ token filters & validation β€’ Transactions β†’ @ Transactional β€’ Actuator β†’ app health, metrics & monitoring β€’ Testing β†’ @ SpringBootTest, @ WebMvcTest, unit & integration tests β€’ Caching β†’ @ Cacheable, cache strategies β€’ Logging β†’ structured logs, logging levels β€’ Reactive Support (optional) β†’ WebFlux for non-blocking apps β€’ Build & Packaging β†’ Maven / Gradle, runnable JAR/WAR
40
55
436
16,522
Lazy vs Eager Loading in JPA Same relationship. Different fetch strategy. Huge performance impact. Let’s understand this with a simple restaurant example 🍽️  Imagine you ordered ONE tea. πŸ”΄ FetchType.EAGERΒ  You ordered one tea.Β Β  But the waiter brought tea snacks dessert together.Β  That’s EAGER loading. When the parent entity is fetched,Β Β  all related entities are loaded immediately β€”Β  Even if they are not required. Good for small relationships.Β Β  Risky for large collections. 🟒 FetchType.LAZYΒ  You ordered one tea.Β Β  The waiter brought only tea.Β  That’s LAZY loading. Related entities are loaded only when accessed.Β  More controlled.Β Β  Usually better for performance. ⚠️ The N 1 Query ProblemΒ  Suppose you fetch 4 users. Query 1 β†’ Fetch usersΒ Β  Query 2 β†’ Orders for User 1Β Β  Query 3 β†’ Orders for User 2Β Β  Query 4 β†’ Orders for User 3Β Β  Query 5 β†’ Orders for User 4Β  Total = 1 N queriesΒ  1 query loads parent entities.Β Β  N additional queries load child data.Β  More database round trips.Β Β  Lower performance. πŸ›  How to Fix ItΒ  βœ” Use JOIN FETCHΒ Β  βœ” Use @EntityGraphΒ Β  βœ” Use DTO projectionΒ  Fetch associations explicitlyΒ Β  to avoid excessive queries. Golden Rule 🧠  EAGER loads immediately.Β Β  LAZY loads on demand.Β  Performance depends on *when* you fetch,Β Β  not just *what* you fetch. Interview Questions I Was Asked: Q1. Why is @ManyToOne EAGER by default?Β Β  A. Because it typically references a single small entity. Q2. What causes the N 1 problem?Β Β  A. Lazy loading inside loops without proper join fetching. Q3. Why is LAZY usually preferred?Β Β  A. It prevents unnecessary joins and reduces memory usage.
1
7
5,142
Yes, we are. Our ancestors came over here legally. And we were born here we’ve been here for multiple generations. They came in through the door not through the window. They assimilated they started speaking English instead of German, or Spanish, or Dutch, or whatever. ManytoOne.
4
26
The best way to map the @ManyToOne association with JPA and Hibernate vladmihalcea.com/manytoone-j…
2
7
60
5,899
25 Oct 2025
finished my Task_Management API. β€’ learned db relationship e.g oneTomany, manyToOne. β€’ added task controller to manage tasks. β€’ ensured only logged in users can update and delete their tasks. β€’ did a little API documentation in the readMe file.
1
5
183
Day-99 of #100daysofcoding Today's topics learned:- -OneToOne relationship -ManyToOne relationship -OneToOne relationship -OneToMany relationship -Caching using spring boot -spring JDBC -mysql connection -using JPA
5
32
868
23 Sep 2025
Replying to @SumitM_X
I solved this problem using EntityGraphs for ManyToOne and OneToOne and set ManyToMany and OneToOne to Fetch(FetchMode.SELECT). This helped me to solve major performance issues.

3
83
the arguments to things like ManyToOne basically takes the list of file paths generated by the glob patterns. and from there you can basically do... whatever the hell you want. OneToOne is smart enough to only transform one output if one input changes.
1
221
#Day32 of #100daysofcoding -Deepened my understanding on JoinColumn, OnetoMany and ManytoOne annotations is SpringBoot -Using Wrapper classes in Entity -Optional<T> class revised. - learned about mappedBy
2
8
162
24 Jul 2025
Day 84/100 of #100DaysOfCode πŸš€ β€’ Mastered @ManyToOne entity relationships β€’ Built repository layer with Spring Data JPA β€’ Fixed dependency injection in REST controllers β€’ Learned transactional service patterns Small steps, solid progress! #Java #SpringBoot
3
70