560 blogs tracked7,114 posts indexed

#hibernate

5 posts · 1 company · newest first

1

How to use PostgreSQL pgvector with JPA, Hibernate, and Spring AI (opens on the source site)

Introduction In this article, I’m going to show you how to map the PostgreSQL vector column type from pgvector to a JPA entity attribute using Hypersistence Utils, and how to use it with Spring AI and Ollama to implement semantic search, recommendations, and Retrieval-Augmented Generation (RAG). Starting with version 3.16.0, the Hypersistence Utils project provides the PostgreSQLVectorType. What is pgvector In AI, an embedding is a numerical vector representation of data (e.g., text, image), which in Java can be represented as an array of floating-point numbers. Two texts having a similar…

hibernatepostgresqlexcerpt only · body stays at the source
From the web
2

How to emulate LEFT JOIN FETCH using Record-based projections (opens on the source site)

Introduction In this article, I’m going to show you how to emulate a LEFT JOIN FETCH between two root entities without fetching the intermediate child entity. I got the inspiration for this article by this comment thread on my blog. Domain Model Let’s assume we have the following entities: The Post is the root entity of our hierarchy, but just like it’s the case with the relational model, the root entity does not have any reference to its children: On the second level of our hierarchy we have the PostDetails: The PostDetails... Read More The post How to emulate LEFT JOIN FETCH using…

hibernatefetchexcerpt only · body stays at the source
From the web
3

The best way to replace the deprecated GenericGenerator (opens on the source site)

Introduction In this article, I’m going to show you the best way to replace the deprecated @GenericGenerator when upgrading your application to Hibernate 7. Hibernate @GenericGenerator annotation The @GenericGenerator annotation has been available since Hibernate 3.5, as an alternative to the XML element from HBM mappings. As illustrated by the Hibernate 6.5 @GenericGenerator Javadoc, this annotation was deprecated in favor of the @IdGeneratorType meta-annotation, which we’ve been using before for the TSID identifier. Traditionally, there were two main use cases where you’d use the…

hibernatedatabase-identifierexcerpt only · body stays at the source
From the web
4

The best way to clean up test data with Spring and Hibernate (opens on the source site)

Introduction In this article, I’m going to show you the best way to clean up test data when using Spring and Hibernate. While it’s very common to use the @DataJpaTest annotation when implementing integration tests, in this blog post, you will see why you are better off avoiding using this annotation. Why I don’t use @DataJpaTest As explained by the manual, Spring Boot provides the @DataJpaTest annotation for Spring Data JPA integration testing. Once the @DataJpaTest annotation is added to an integration test, Spring Boot will make the following changes to the... Read More The post The best…

hibernatespringexcerpt only · body stays at the source
From the web
5

How to map the Oracle TIMESTAMP WITH TIME ZONE with JPA (opens on the source site)

Introduction In this article, I’m going to explain how to map the Oracle TIMESTAMP WITH TIME ZONE with JPA and Hibernate. While the DATE and TIMESTAMP column types are suitable for mapping the LocalDateTime, the TIMESTAMP WITH TIME ZONE column type allows us to map both the ZonedDateTime and OffsetDateTime. Oracle TIMESTAMP WITH TIME ZONE Traditionally, Oracle provided the DATE and TIMESTAMP column types to store timestamp values. The difference between the DATE and TIMESTAMP types is that the TIMESTAMP column type allows us to store fractional seconds while the DATE type... Read More The…

hibernatejpaexcerpt only · body stays at the source
From the web
5 shown

Privacy choices

Reading never requires analytics. These choices last 90 days on this browser.

Essential sign-in and security storage always stays on. Read the privacy notice.