Vlad Mihalcea

  • Home
  • Blog
  • Store
    • Books
    • Courses
    • Hypersistence Optimizer
      • Documentation
        • Installation Guide
        • User Guide
      • Examples
      • Release Notes
      • Issue Tracker
      • Trial Version
      • Full Version
    • Affiliate
  • Training
    • High-Performance Java Persistence
    • High-Performance Spring Persistence
    • High-Performance SQL
    • Spring and Hibernate 6
  • Consulting
    • Coaching
  • Tutorials
    • Hibernate
    • SQL
    • Spring
  • Newsletter
    • Subscribe
    • Videos
    • Talks

Posted on August 24, 2017 by vladmihalcea

How to get the entity mapping to database table binding metadata from Hibernate

Introduction 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 particular use 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.

Posted on November 17, 2016 by vladmihalcea

How to map calculated properties with JPA and Hibernate @Formula annotation

Introduction As I explained in this StackOverflow question, mapping calculated properties is very easy with JPA and Hibernate. In this post, I’m going to demonstrate how you can derive some entity property based on one or multiple persistent entity attributes.

Posted on September 20, 2016 by vladmihalcea

The best way to lazy load entity attributes using JPA and Hibernate

Introduction When fetching an entity, all attributes are going to be loaded as well. This is because every entity attribute is implicitly marked with the @Basic annotation whose default fetch policy is FetchType.EAGER. However, the attribute fetch strategy can be set to FetchType.LAZY, in which case the entity attribute is loaded with a secondary select statement upon being accessed for the first time. This configuration alone is not sufficient because Hibernate requires bytecode instrumentation to intercept the attribute access request and issue the secondary select statement on demand.

Posted on August 9, 2016 by vladmihalcea

Fluent API entity building with JPA and Hibernate

Introduction In this article, we are going to see how we can build an entity in a fluent style API fashion when using JPA and Hibernate. The JHipster development team wants to expose a Fluent Interface entity building methods for their JPA entities, so they asked me if this is going to work with JPA and Hibernate. While JPA is rather strict about entity getters and setter, Hibernate is more lenient in this regard.

Posted on June 6, 2016 by vladmihalcea

How to implement equals and hashCode using the JPA entity identifier (Primary Key)

Introduction As previously explained, using the JPA entity business key for equals and hashCode is always the best choice. However, not all entities feature a unique business key, so we need to use another database column that is also unique as the primary key. But using the entity identifier for equality is very challenging, and this post is going to show you how you can use it without issues.

« 1 2
Let’s connect
  • X
  • YouTube
  • LinkedIn
  • Email
  • Facebook
  • Amazon
  • GitHub
Find Article
Become a Java Champion
Java Champion Logo
Riveran
Riveran - Adopt AI with confidence!
Book
High-Performance Java Persistence Book
Video Courses
High-Performance Java Persistence Video Course High-Performance SQL Video Course
Sponsored
Training
Training logo
Hypersistence Optimizer
Hypersistence Optimizer
Tutorials
  • Hibernate
  • SQL
  • Spring
  • Git
  • FlexyPool
Social Media
  • Twitter
  • Facebook
  • YouTube
  • GitHub
  • LinkedIn
About
  • About
  • FAQ
  • Archive
  • Privacy Policy
  • Terms of Service
  • Cookie Policy (EU)
Meta
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Vlad Mihalcea

Powered by WordPress.com.

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}