ObjectDB Database Search

1-5 of 5 results

JPA Primary Key

: PersistenceUnitUtil util = emf. getPersistenceUnitUtil (); Object projectId = util. getIdentifier ... ; getIdentifier method takes one argument, a managed entity object, and returns the primary key. In the case

PersistenceUnitUtil.getIdentifier(entity) - JPA Method

JPA Method in javax.persistence.PersistenceUnitUtil Object getIdentifier (   Object entity ) Return the id of the entity. A generated id is not guaranteed to be available until after the database insert has occurred. Returns null if the entity does not yet have an id. Parameters

javax.persistence.PersistenceUnitUtil

for this persistence unit or on new entity instances. Since: JPA 2.0 Public Methods Object getIdentifier

Populating entity id before transaction commit

you can force early auto ID setting by: Object id = emf. getPersistenceUnitUtil() . getIdentifier

Entity listener - event instead of object

= event.getPersister().hasIdentifierProperty() ? event.getPersister(). getIdentifier (event.getEntity