If the entity has been changed further in the transaction, the CreationTimestamp may not be set
If the entity persisted in transaction is further modified, then the @CreationTimestamp field will become null. Are there any solutions to this problem? Magic hibernate flags? Or do we only have to create the field manually in the @PrePersist method? I also don’t want to flush the data after the persist method, as this is an unnecessary database call.
How to fetch multiple levels using JPA specifications
Given a structure such as : School -> Students -> PhoneNumbers
Hibernate generating N(N+1) Updates for each Insert
On Hibernate 6.4.4 and 6.4.9, I am observing the following odd behavior.
How to handle multiple self referencing foreign keys in Hibernate
I have a MYSQL table that has 2 foreign keys to other rows of the same table. (for simplicities sake, I have changed it to a person table, that’s not what I am trying to achieve, but similar structure).
JPA: how to map a composite key with an embedded object (PostInitCallback error in hibernate when initializing)
I’m mapping two entities 1:n where the many-side has a composite primary key. So far so good.
Entity Scan in persistence.xml inside the same “jar”, NO SPRING wanted
In my library project I have some JPA @Entity
classes and a couple of JPA utils.
Problem with proper usage of orphan removal
I use spring boot 2.7.18 with java 17 and maven. Please treat it purely for educational purposes (don’t shout at me that that’s not how filtering and updating should work, I know it). I’ve created that simple example after reading the article about ‘best way to handle hibernate MultipleBagFetchException’ and stumbled upon the problem with […]
Keeping both sides of a bidirectional one-to-many reference consistent in java
I’ve done a lot of googling about this without much success, every time I look how people track bidirectional relations, it looks something like this:
Override columnDefinition in hibernate
I’m having an issue where a JPAentity I’m importing from another library has a field that’s hardcoded to be columnDefinition = TEXT
but I’d like that field to be LONGTEXT in the db. I am not allowed to edit to the JPAentity itself, nor can I just make my own. Is there a way to force this via a custom dialect somehow?
Id public field sometimes null
I experience a strange behavior of the @Id field content in my app.
My entities are straight-forward: