Search in sources :

Example 1 with Assigned

use of org.hibernate.id.Assigned in project hibernate-orm by hibernate.

the class AbstractEntityTuplizer method resetIdentifier.

@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));
        }
    }
}
Also used : Assigned(org.hibernate.id.Assigned) Serializable(java.io.Serializable)

Aggregations

Serializable (java.io.Serializable)1 Assigned (org.hibernate.id.Assigned)1