Lukas Eder has posted a very interesting question on Stack Overflow, asking about a way of getting access to the binding metadata between entity mappings and database tables.
While I have previously answered a similar question using this article, I realized that case was much simpler since it only extracted the database metadata. In this article, you are going to see how easily you can get the bridge information between your JPA entities and the underlying database schema.
Continue reading “How to get the entity mapping to database table binding metadata from Hibernate”
One of my readers has recently asked me to answer this StackOverflow question, and because the question is very interesting, I decided to turn the answer into a blog post.
In this article, I’m going to show you how you can get access to database table metadata using Hibernate 5 API.
Continue reading “How to get access to database table metadata with Hibernate 5”
From a data access perspective, JPA supports two major types of identifiers:
The assigned identifiers must be manually set on every given entity prior to being persisted. For this reason, assigned identifiers are suitable for natural keys.
For synthetic Primary Keys, we need to use a generated entity identifier, which is supported by JPA through the use of the
There are four types of generated identifier strategies which are defined by the
AUTO identifier generator strategy chooses one of the other three strategies (
TABLE) based on the underlying relational database capabilities.
IDENTITY maps to an auto-incremented column (e.g.
IDENTITY in SQL Server or
AUTO_INCREMENT in MySQL) and
SEQUENCE is used for delegating the identifier generation to a database sequence, the
TABLE generator has no direct implementation in relational databases.
This post is going to analyze why the
TABLE generator is a poor choice for every enterprise application that cares for performance and scalability.
Continue reading “Why you should never use the TABLE identifier generator with JPA and Hibernate”