How to use symbolic links to move the DB data folder
Vlad Mihalcea
by vladmihalcea
2d ago
Introduction In this article, we are going to see how we can use symbolic links to move the DB data folder. The reason why I needed to move the data folder from the C to the D Windows partition was because the C partition was running out of disk space. DB data folder A relational database system requires to store the table records and the index entries on the disk. Besides that, there are other database components that need to be persisted on disk, such as the Redo Log that contains all... Read More The post How to use symbolic links to move the DB data folder appeared first on Vlad Mihalcea ..read more
Visit website
Book Review – Beginning Helidon
Vlad Mihalcea
by vladmihalcea
2w ago
Introduction My friend, Dmitry Aleksandrov, has been very generous in giving me a copy of his Helidon book, which he co-authored with Dmitry Kornilov and Daniel Kec. Since I was interested in learning about Helidon, I decided to read this book and see what approach it takes to develop Java applications, as opposed to Spring Boot. The book is called Beginning Helidon, and it’s a very good introduction to this framework. Audience This book is useful for any Java developer who plans on developing lightweight microservice applications using Helidon. Content Beginning Helidon... Read More The post ..read more
Visit website
High-Performance Java Persistence Newsletter, Issue 64
Vlad Mihalcea
by vladmihalcea
3w ago
Introduction Welcome to a new issue of the High-Performance Java Persistence Newsletter in which we share articles, videos, workshops, and StackOverflow answers that are very relevant to any developer who interacts with a database system using Java. Articles The pick of this week is this article about the drawbacks of using natural keys. Speaking of mapping tables, if you need to persist a Java Enum Object to an integer column, JPA provides the ORDINAL strategy that allows you to save the default ordinal value into the integer column. However, if you have... Read More The post High-Performance ..read more
Visit website
How does the Hibernate JAVA_TIME_USE_DIRECT_JDBC setting work
Vlad Mihalcea
by vladmihalcea
1M ago
Introduction In this article, we are going to see how the Hibernate JAVA_TIME_USE_DIRECT_JDBC setting works and what JDBC Driver supports this feature. This setting can be set programmatically, as illustrated by the following Spring Java-based configuration: Or you can set it declaratively in the Spring Boot application.properties configuration file like this: Domain Model To test how the Hibernate JAVA_TIME_USE_DIRECT_JDBC setting works, we are going to use the following DateTimeEvent entity: As I explained in this article, by default, Hibernate uses the PreparedStatement.setTimestamp(int par ..read more
Visit website
Hibernate WITH RECURSIVE query
Vlad Mihalcea
by vladmihalcea
1M ago
Introduction In this article, we are going to see how the Hibernate WITH RECURSIVE query works and how we can use it to fetch hierarchical data structures. Domain Model Let’s consider we have the following post and post_comment tables: The post_comment child table has a one-to-many table relationship with the parent post table via the post_id Foreign Key column in the post_comment table. Additionally, the post_comment table has a self-referencing Foreign Key via the parent_id column, which can reference a record from the same post_comment table. The Post entity is mapped as... Read More The po ..read more
Visit website
High-Performance Java Persistence Newsletter, Issue 63
Vlad Mihalcea
by vladmihalcea
1M ago
Introduction Welcome to a new issue of the High-Performance Java Persistence Newsletter in which we share articles, videos, workshops, and StackOverflow answers that are very relevant to any developer who interacts with a database system using Java. Articles The pick of this week is this article from Gergely Orosz about designing and scaling Bluesky. You will learn about favoring flexibility, how to scale the data access layer, how to migrate from PostgreSQL to ScyllaDB, and how to reduce infrastructure costs. Speaking of PostgreSQL, if you run a query more than 5 times... Read More The post H ..read more
Visit website
Hibernate ON CONFLICT DO clause
Vlad Mihalcea
by vladmihalcea
2M ago
Introduction In this article, we are going to see how the Hibernate ON CONFLICT DO clause works, and how we can use it to execute an SQL UPSERT statement in a portable way. Upsert As I explained in this article, if you have this use case where you need to either INSERT or UPDATE a table record based on whether the underlying table contains the record or not, then we need to use an Upsert statement. While Hibernate offers an upsert method in the StatelessSession, there is also an alternative for JPQL... Read More The post Hibernate ON CONFLICT DO clause appeared first on Vlad Mihalcea ..read more
Visit website
PostgreSQL COPY result set to file
Vlad Mihalcea
by vladmihalcea
2M ago
Introduction In this article, we are going to se how we can use the PostgreSQL COPY command to export a large result set to an external file. ETL (Extract, Transform, Load) When implementing an ETL (Extract, Transform, Load) process, you might have to extract a large result set from a relational database in order to transform it according to some specific business rules. Let’s assume we have to export the result set of the following SQL query: If we have only 2 post records, each one having 5 post_comment child rows associated... Read More The post PostgreSQL COPY result set to file appeared f ..read more
Visit website
PostgreSQL plan_cache_mode
Vlad Mihalcea
by vladmihalcea
2M ago
Introduction In this article, we are going to analyze the PostgreSQL plan_cache_mode setting and see when it’s useful to override a given generic plan using the the force_custom_plan strategy. Domain Model Let’s assume we have the following post table: The post_status type is an Enum that was created like this: We have 100,000 post records in our database that have a very skewed distribution of status values. For example, if we run the following SQL query: We get the following results: 95% of the post records match the APPROVED status value. 4%... Read More The post PostgreSQL plan_cache_mode ..read more
Visit website
Overriding FetchType.EAGER with fetchgraph
Vlad Mihalcea
by vladmihalcea
2M ago
Introduction In this article, we are going to see how you can override the FetchType.EAGER strategy using the fetchgraph query hint. While this feature has been available in the JPA specification since version 2.1, Hibernate has only supported this feature since version 5.5. JPA FetchType.EAGER and FetchType.LAZY strategies The fetching strategy can be specified either at the entity mapping level or when building a query. At the entity mapping level, the fetch attribute of the @ManyToOne, @OneToOne, @OneToMany, @ManyToMany, or @ElementCollection can use either the FetchType.LAZY or FetchType.E ..read more
Visit website

Follow Vlad Mihalcea on FeedSpot

Continue with Google
Continue with Apple
OR