Tag: java


  • Conquering Concurrency: Pessimistic Locking in Spring Boot

    In the bustling world of multi-user applications, ensuring data integrity becomes paramount. When multiple users contend for the same resource, conflicts can arise, leading to lost updates and unintended side effects. Here’s where pessimistic locking steps in, acting as a valiant knight guarding data consistency in Spring Boot applications. What is Pessimistic Locking? Imagine two…

  • How to find out the differences between 2 objects in Java (2023)

    [web_stories title=”true” excerpt=”false” author=”false” date=”false” archive_link=”true” archive_link_label=”” circle_size=”150″ sharp_corners=”false” image_alignment=”left” number_of_columns=”1″ number_of_stories=”5″ order=”DESC” orderby=”post_title” view=”circles” /] In this post, we will showcase a step-by-step guide on how to detect and present distinctions between two java objects by leveraging a set of classes and interfaces provided by Apache Commons Lang. Classes, Interfaces, and pom.xml The classes…

  • How To Create Custom Annotation In Java

    Create Custom Annotation: In java, creating an annotation is @interface is used to create an Annotation. public @interface MyAnnotation{ } We can also define methods inside an annotation. public @interface MyAnnotation{ int value(); } Note: The methods of an annotation should adhere to the following rules: Method declaration should not have any parameters Method declaration should not…

  • How To Kill Thread in Java

    There is no official method to kill a thread in Java. Stopping a thread is entirely managed by the JVM. Although Java provides several ways to manage the thread lifecycle such as a start(), sleep(), stop() (deprecated in Java 1.1), etc. but does not provide any method to kill a thread and free the resources cleanly. Oracle specified the reason for deprecating the…

  • H2 Schema Initialisation Syntax Error in Sql Statement

    Application Startup error: But I got ‘Syntax error in SQL statement’ on application startup: Error: 19:08:45.642 6474 [main] INFO o.h.tool.hbm2ddl.SchemaExport – HHH000476: Executing import script ‘/import.sql’ 19:08:45.643 6475 [main] ERROR o.h.tool.hbm2ddl.SchemaExport – HHH000388: Unsuccessful: CREATE TABLE Person ( 19:08:45.643 6475 [main] ERROR o.h.tool.hbm2ddl.SchemaExport – Syntax error in SQL statement “CREATE TABLE PERSON ( [*]”; expected…