My table in the database has a column that is populated automatically by the database itself.
This table is mapped as a class annotated with @Entity, called EntidadeA
. The column that is populated automatically is mapped to a property annotated with @column, called prop1
.
When running EntityManager.persist(objeto)
, with the prop1
property null
property, hibernate executes a INSERT INTO tb... (coluna_prop1, ...) values (NULL, ...)
in the database.
At this point the database points to a YYY value in column_prop1.
Question: How to make the hibernate reler of the database immediately after the persist, the value of a column ?
Note: I currently run EntityManager.refresh(objeto)
shortly after persist () --- it works, but this causes hibernate to rerun all database properties (ie inefficient). >