@Override public void setIdentifier(Object entity, Serializable id) throws HibernateException { // 99% of the time the session is not needed. Its only needed for certain brain-dead // interpretations of JPA 2 "derived identity" support setIdentifier( entity, id, null ); }
@Override public final Object instantiate(Serializable id, SharedSessionContractImplementor session) { Object result = getInstantiator().instantiate( id ); if ( id != null ) { setIdentifier( result, id, session ); } return result; }
@Override public void resetIdentifier( Object entity, Serializable currentId, Object currentVersion, SharedSessionContractImplementor session) { //noinspection StatementWithEmptyBody if ( entityMetamodel.getIdentifierProperty().getIdentifierGenerator() instanceof Assigned ) { } else { //reset the id Serializable result = entityMetamodel.getIdentifierProperty() .getUnsavedValue() .getDefaultValue( currentId ); setIdentifier( entity, result, session ); //reset the version VersionProperty versionProperty = entityMetamodel.getVersionProperty(); if ( entityMetamodel.isVersioned() ) { setPropertyValue( entity, entityMetamodel.getVersionPropertyIndex(), versionProperty.getUnsavedValue().getDefaultValue( currentVersion ) ); } } }
/** * {@inheritDoc} */ public void setIdentifier(Object entity, Serializable id) throws HibernateException { // 99% of the time the session is not needed. Its only needed for certain brain-dead // interpretations of JPA 2 "derived identity" support setIdentifier( entity, id, null ); }
/** * {@inheritDoc} */ public void setIdentifier(Object entity, Serializable id) throws HibernateException { // 99% of the time the session is not needed. Its only needed for certain brain-dead // interpretations of JPA 2 "derived identity" support setIdentifier( entity, id, null ); }
public final Object instantiate(Serializable id, SessionImplementor session) { Object result = getInstantiator().instantiate( id ); if ( id != null ) { setIdentifier( result, id, session ); } return result; }
public final Object instantiate(Serializable id, SessionImplementor session) { Object result = getInstantiator().instantiate( id ); if ( id != null ) { setIdentifier( result, id, session ); } return result; }
/** * {@inheritDoc} */ public void resetIdentifier( Object entity, Serializable currentId, Object currentVersion, SessionImplementor session) { if ( entityMetamodel.getIdentifierProperty().getIdentifierGenerator() instanceof Assigned ) { } else { //reset the id Serializable result = entityMetamodel.getIdentifierProperty() .getUnsavedValue() .getDefaultValue( currentId ); setIdentifier( entity, result, session ); //reset the version VersionProperty versionProperty = entityMetamodel.getVersionProperty(); if ( entityMetamodel.isVersioned() ) { setPropertyValue( entity, entityMetamodel.getVersionPropertyIndex(), versionProperty.getUnsavedValue().getDefaultValue( currentVersion ) ); } } }
/** * {@inheritDoc} */ public void resetIdentifier( Object entity, Serializable currentId, Object currentVersion, SessionImplementor session) { if ( entityMetamodel.getIdentifierProperty().getIdentifierGenerator() instanceof Assigned ) { } else { //reset the id Serializable result = entityMetamodel.getIdentifierProperty() .getUnsavedValue() .getDefaultValue( currentId ); setIdentifier( entity, result, session ); //reset the version VersionProperty versionProperty = entityMetamodel.getVersionProperty(); if ( entityMetamodel.isVersioned() ) { setPropertyValue( entity, entityMetamodel.getVersionPropertyIndex(), versionProperty.getUnsavedValue().getDefaultValue( currentVersion ) ); } } }