DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library
Core Badge
Avatar

Anghel Leonard

DZone Core CORE

Chief Technology Strategist at -

Banesti, RO

Joined Apr 2006

Stats

Reputation: 2270
Pageviews: 1.9M
Articles: 42
Comments: 35
  • Articles
  • Comments

Articles

article thumbnail
Mastering Date/Time APIs: Challenges With Java's Calendar and JDK Date/Time APIs
Test your Java skills with four problems focused on Calendar API and JDK Date/Time APIs, including ChronoUnit, IsoFields, TemporalAdjusters, and more.
October 15, 2024
· 7,609 Views · 8 Likes
article thumbnail
Tackling Records in Spring Boot
Let’s take a look at several scenarios where Java records can help us increase readability and expressiveness by squeezing the homologous code.
May 21, 2024
· 5,730 Views · 5 Likes
article thumbnail
Running a Spring Boot Application Under Payara Server Using a Payara Data Source
You can use a JDBC resource and connection pool to run your Spring Boot apps with Payara Data.
Updated October 27, 2023
· 28,504 Views · 10 Likes
article thumbnail
Paginating JOINs via jOOQ and DENSE_RANK()
In this tutorial, discover how jOOQ and window function DENSE_RANK() can help us to paginate JOINs.
March 6, 2023
· 5,046 Views · 2 Likes
article thumbnail
Implementing Infinite Scroll in jOOQ
Infinite scroll is a classical usage of keyset pagination and is gaining popularity these days.
Updated January 17, 2023
· 9,648 Views · 2 Likes
article thumbnail
How to Delay Database Connection Acquisition in Hibernate (Spring Data)
In the case of resource-local (a single data source), Hibernate will acquire the database connection of a JDBC transaction right after the transaction starts.
April 16, 2021
· 16,218 Views · 5 Likes
article thumbnail
SQL Phenomena for Developers
These phenomena represent a set of data integrity anomalies that may occur when a developer tries to squeeze performance from transaction concurrency.
March 15, 2021
· 14,933 Views · 12 Likes
article thumbnail
8 Rules For Creating Useful Database Indexes
Creating databases indexes is easy, but creating useful database indexes is quite challenging.
October 6, 2020
· 17,113 Views · 3 Likes
article thumbnail
How to Decide Between JOIN and JOIN FETCH
Deciding between JOIN and JOIN FETCH is a matter of performance!
September 21, 2020
· 59,195 Views · 12 Likes
article thumbnail
How to Obtain Auto-Generated Keys With Hibernate
How to obtain auto-generated keys in a Hibernate - Spring Boot application.
September 16, 2020
· 15,315 Views · 4 Likes
article thumbnail
How to Populate a Child-Side Parent Association via a Hibernate-Specific Proxy
A handy solution to avoid a common persistence performance penalty.
July 21, 2020
· 12,738 Views · 6 Likes
article thumbnail
Spring Transaction Propagation in a Nutshell
Diving into Spring Transaction Propagation mechanism
June 16, 2020
· 90,926 Views · 19 Likes
article thumbnail
Why Set Is Better Than List in @ManyToMany
In this article, we'll highlight the performance penalties involves by using List or Set in @ManyToMany relationships.
June 10, 2020
· 24,059 Views · 6 Likes
article thumbnail
Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 4)
Learn more about improving your performance in Hibernate 5 and Spring Boot 2 applications.
May 15, 2020
· 28,066 Views · 16 Likes
article thumbnail
Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)
Make sure you are practicing the best performance practices in your Spring Boot and Hibernate projects.
Updated May 11, 2020
· 353,141 Views · 114 Likes
article thumbnail
JDK 14 Records for Spring
In this article, we'll discuss several use cases for JDK 14 Records to write cleaner and more efficient code.
April 29, 2020
· 17,310 Views · 7 Likes
article thumbnail
Read/Write a Raw JSON, Array-Like JSON, and Map-Like JSON File as an Object
In this article, take a look at a tutorial that explains how to read/write a raw JSON, array-like JSON, and map-like JSON file as an object.
April 22, 2020
· 27,972 Views · 6 Likes
article thumbnail
JDK 11 HTTP Client API - Handling Request/Response Body Types
In this article, we discuss how to deal with requests and response body types in an HTTP client API in Java.
Updated April 6, 2020
· 34,233 Views · 9 Likes
article thumbnail
Checking Whether Two Arrays Are Equal or Contain Mismatches
Use this tutorial to determine whether two arrays are equal or mismatched using the JDK API.
Updated February 25, 2020
· 12,741 Views · 5 Likes
article thumbnail
Java Switch Expressions For Impatiens
This is the super-fast guide of Java 12/13 switch expressions. Learn how to use switch expressions in 5 minutes.
February 12, 2020
· 15,626 Views · 10 Likes
article thumbnail
Working With Temporary Files/Folders in Java
The Java NIO.2 API provides support for working with temporary folders/files. This tutorial demonstrates how to work with these files in Java.
January 30, 2020
· 78,790 Views · 14 Likes
article thumbnail
Search in Big Files Via MappedByteBuffer
Learn more about search in big files via MappedByteBuffer.
December 4, 2019
· 14,810 Views · 8 Likes
article thumbnail
Java 11 Nest-Based Access Control Via Reflection
Learn more about nest-based access control via Java 11 reflections.
November 19, 2019
· 11,951 Views · 4 Likes
article thumbnail
Practical Guide For Converting Between Date and Temporal
Check out this practical code guide on converting between Date and Temporal classes in Java.
November 12, 2019
· 32,254 Views · 4 Likes
article thumbnail
Why Do We Need Thread.currentThread().interrupt() in Interruptible Methods?
Let's evaluate why we need Thread.currentThread().interrupt() in interruptible methods.
Updated November 5, 2019
· 73,643 Views · 8 Likes
article thumbnail
26 Items for Dissecting Java Local Variable Type Inference (Var Type)
Learn everything you need to know and more about the var type inference!
Updated October 24, 2019
· 32,516 Views · 30 Likes
article thumbnail
HTTP/2 Server Push Via Java 11 HTTP Client API
Do you remember HttpUrlConnection? Well, JDK 11 has reinvented this server push using the HTTP Client API. Check it out!
October 23, 2019
· 22,773 Views · 4 Likes
article thumbnail
Deadlock in Databases
Here's why you need to avoid database deadlock.
May 28, 2019
· 8,429 Views · 4 Likes
article thumbnail
How to Enrich DTOs With Virtual Properties Via Spring Projections
Learn more about how to enrich DTOs with Spring projections.
Updated March 5, 2019
· 23,231 Views · 8 Likes
article thumbnail
How to Use Hibernate Natural IDs in Spring Boot
This article is a quick practical guide for using Hibernate Natural IDs (@NaturalId) in Spring Data style.
February 12, 2019
· 28,867 Views · 10 Likes

Comments

How to Use Hibernate Natural IDs in Spring Boot

Mar 27, 2023 · Anghel Leonard

Moreover, your approach doesn't benefit from Hibernate implementation which handles caching. This is useful for bookmarkable URLs.

How to Use Hibernate Natural IDs in Spring Boot

Mar 27, 2023 · Anghel Leonard

Based on your suggestion, you should add a findById(), findAll(), and so on in every repo.

Running a Spring Boot Application Under Payara Server Using a Payara Data Source

Nov 24, 2020 · Anghel Leonard

Most probably you should manually add s compatible Snake YAML dependency https://mvnrepository.com/artifact/org.yaml/snakeyaml

How to Enrich DTOs With Virtual Properties Via Spring Projections

Jun 08, 2020 · Anghel Leonard

Hi,

You mention "dynamic projection". Is this helping you:

Via DTO class:

https://github.com/AnghelLeonard/Hibernate-SpringBoot/tree/master/HibernateSpringBootDynamicProjectionClass

Via interface:

https://github.com/AnghelLeonard/Hibernate-SpringBoot/tree/master/HibernateSpringBootDynamicProjection

JDK 14 Records for Spring

May 10, 2020 · Anghel Leonard

Correct

Read/Write a Raw JSON, Array-Like JSON, and Map-Like JSON File as an Object

Apr 23, 2020 · Anghel Leonard

Thanks! Well, this is a topic of a new and comprehensive article. Nevertheless, a nice benchmark can be found here: https://interviewbubble.com/performance-comparison-of-json-libraries-jackson-vs-gson-vs-fastjson-vs-json-simple-vs-jsonp/.. Probably Jackson is the most used by Spring/SpringBoot devs. For Jakarta EE devs JSON-B is the way to go.

Java Switch Expressions For Impatiens

Feb 20, 2020 · Anghel Leonard

Java Switch Expressions For Impatiens

Feb 20, 2020 · Anghel Leonard

HTTP/2 Server Push Via Java 11 HTTP Client API

Oct 31, 2019 · Anghel Leonard

Consider the client trigger a request for an HTML page from the server. That request will have associated a PUSH_PROMISE frame (this is specific to the current stream ID). The client retrieves the PUSH_PROMISE frame before receiving the requested data (the HTML or other pushed resources). This frame has a header containing information useful to the client to control which resources are to be sent. Otherwise, the PUSH_PROMISE frame will send an unnecessary request for the data that will be already available. This is exactly what you point out :) Now, the client stores the pushed data in the cache and can reuse it later between different pages. For a cached or unecessary resource, the RST_STREAM frame can be rejected or the number of pushed streams can be limited. That's all! I hope it helps :)

Running a Spring Boot Application Under Payara Server Using a Payara Data Source

Jun 13, 2019 · Anghel Leonard

The app from the article was deployed successfully on Payara 5.183. so very close to yours. With Spring Boot 2.0.6. Maybe, you run a new version of Spring Boot. Seems something not compatible here:

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>...</version>
</dependency>

ReentrantLock Cheat Sheet

May 17, 2019 · Thomas Krieger

Crystal clear! Thanks!

ReentrantLock Cheat Sheet

May 17, 2019 · Thomas Krieger

If yes, why not "if"?

ReentrantLock Cheat Sheet

May 17, 2019 · Thomas Krieger

I assume you refer to some external condition meant to determine to put the notFull in await or not. Correct?

ReentrantLock Cheat Sheet

May 17, 2019 · Thomas Krieger

Please explain why:

while( condition not fullfilled) {
notFull.await();
}

And, not just:

notFull.await();

What to put in place of "not fullifiled"?

How to Enrich DTOs With Virtual Properties Via Spring Projections

Mar 07, 2019 · Anghel Leonard

When the application relies on JPA for fetching data from a database it will result in a persistent context holding the fetched snapshot (entities). This is needed by the JPA implementation to ensure data management (e.g., manage state transitions of the entities). But, this management is needed only for entities that are prone to be modified otherwise is just a performance penalty that is reflected in CPU and memory. On the other hand, fetching the read-only data as DTOs directly will avoid this overhead (the persistent context will not be populated with the snapshot and data will not be managed by JPA). Moreover, DTOs allows you to easily fetch only a subset of the properties of an entity.I hope is clear now.

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Jan 31, 2019 · Anghel Leonard

Well, mainly is a trade-off between lowering network overhead (rewriteBatchedStatements) and faster execution of queries (useServerPrepStmts). I suggest you to try a benchmark and see which one fits the best for your specific case.

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Jan 31, 2019 · Anghel Leonard

As a rule of thumb, before activating these features, it is better to check the latest Connector/J release notes and validate these features are safe for use together.

In this case, I suggest relying on MySQL Connector/J, which does not specify this conflict: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html.

You can follow HikariCP example of configuration as well (notice that "useServerPrepStmts" and "rewriteBatchedStatements " are set to "true": https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration

Running a Spring Boot Application Under Payara Server Using a Payara Data Source

Jan 11, 2019 · Anghel Leonard

I think that this can be a start point: https://blog.payara.fish/using-payara-embedded-and-payara-micro-with-maven

26 Items for Dissecting Java Local Variable Type Inference (Var Type)

Jan 03, 2019 · Anghel Leonard

Good catch :) Thanks!

26 Items for Dissecting Java Local Variable Type Inference (Var Type)

Dec 21, 2018 · Anghel Leonard

So, in the first example, the inferred type will be List or Set. In the second example, it will be int or String. In "uncertain" cases, the inferred type will be the broadest applicable type, which is often Object.

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Dec 12, 2018 · Anghel Leonard

I've updated item 2 based on your suggestion, thanks man!

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Dec 12, 2018 · Anghel Leonard

I've updated item 2 based on your suggestion, thanks man!

26 Reasons Why Using Optional Correctly Is Not Optional

Dec 05, 2018 · Anghel Leonard

Thank you Charles for this valuable comment :)

26 Reasons Why Using Optional Correctly Is Not Optional

Dec 05, 2018 · Anghel Leonard

So, the method returns String, not Optional, but the code uses Optional in order to decide what String to return instead of a straightforward null check. The idea is that Optional is improperly used that way, just as a null checker.

26 Reasons Why Using Optional Correctly Is Not Optional

Dec 02, 2018 · Anghel Leonard

You're welcome! I'm glad that you enjoyed the article :)

26 Reasons Why Using Optional Correctly Is Not Optional

Nov 28, 2018 · Anghel Leonard

done! thanks!

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Nov 21, 2018 · Anghel Leonard

I have just added at the bottom of the article. Thanks for the suggestion!

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Nov 20, 2018 · Anghel Leonard

I am glad that you enjoyed it! Part 2 is here.

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Nov 19, 2018 · Anghel Leonard

You're welcome! :)

The Keys to Making Important Technical Decisions

Nov 19, 2018 · Anghel Leonard

I'm glad that you enjoyed the article. I prepare a VP of TPM dedicated article in several days (a week). I'll let you know :)

The Keys to Making Important Technical Decisions

Nov 17, 2018 · Anghel Leonard

Thanks :)

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Nov 17, 2018 · Anghel Leonard

I'm glad that you found the article useful.

About OSIV: yes, I prefer to set it as "false", this is the way to go since is default "true" in Spring Boot and can cause serious performance penalties. In part two of this article, there will be an item dedicated to optimize the OSIV when you decide to use it anyway. In addition in my book, "Java Persistence Performance Illustrated Guide", there is a section dedicated to OSIV drawbacks and flow.

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Nov 16, 2018 · Anghel Leonard

didn't know about it :)

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 1)

Nov 16, 2018 · Anghel Leonard

Never try it :) But, I will, thanks for your suggestion

Why You Should Avoid JSF

Nov 18, 2014 · James Sugrue

Obviously, the author of this article doesn't know enough JSF and he doesn't like JSF! Well, after he read the comments, I'm sure he learned a lot of JSF. But, instead of using his time to tell us what he knows and he likes, he loses time to tell us what he doesn't know and what he doesn't like! Pretty illogical!

What is this "article" about (and the final conclusion, which is actually the single interesting part) ? "Don’t use JSF" ...

Is this the wise man's advice to novice ?

I don't think so, because is too radical to belong to a wise man.

Is the teacher talking to students ?

Obviously, not! Some answers here comes from real JSF gurus, that cannot be considered students.

Is the professional voice that puts the things in order?

Mmmm, nope! Professionals acts as professionals! You cannot be master of multiple frameworks, so such radical opinions should remain private thoughts, or at least not so exposed.

Is just a moment of frustration ?

Well, nope again! There is no "exclamation" point there.

Is an old trick to give birth to a dispute ?

Yeap! Or ... he is the Good Samaritan that will save the world from JSF ...

User has been successfully modified

Failed to modify user

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook