Skip to content

Commit

Permalink
add PersistenceUnitUtil.getVersion()
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Aug 10, 2023
1 parent 07c7579 commit ba90744
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion api/src/main/java/jakarta/persistence/PersistenceUnitUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,16 @@ public interface PersistenceUnitUtil extends PersistenceUtil {
* to be an entity
*/
public Object getIdentifier(Object entity);
}

/**
* Return the version of the entity.
* A generated version is not guaranteed to be available until after
* the database insert has occurred.
* Returns null if the entity does not yet have an id.
* @param entity entity instance
* @return id of the entity
* @throws IllegalArgumentException if the object is found not
* to be an entity
*/
public Object getVersion(Object entity);
}

0 comments on commit ba90744

Please sign in to comment.