Search in sources :

Example 1 with UniqueEntityLoader

use of org.hibernate.loader.entity.UniqueEntityLoader in project hibernate-orm by hibernate.

the class AbstractEntityPersister method createLoaders.

// Relational based Persisters should be content with this implementation
protected void createLoaders() {
    final Map loaders = getLoaders();
    loaders.put(LockMode.NONE, createEntityLoader(LockMode.NONE));
    UniqueEntityLoader readLoader = createEntityLoader(LockMode.READ);
    loaders.put(LockMode.READ, readLoader);
    // TODO: inexact, what we really need to know is: are any outer joins used?
    boolean disableForUpdate = getSubclassTableSpan() > 1 && hasSubclasses() && !getFactory().getDialect().supportsOuterJoinForUpdate();
    loaders.put(LockMode.UPGRADE, disableForUpdate ? readLoader : createEntityLoader(LockMode.UPGRADE));
    loaders.put(LockMode.UPGRADE_NOWAIT, disableForUpdate ? readLoader : createEntityLoader(LockMode.UPGRADE_NOWAIT));
    loaders.put(LockMode.UPGRADE_SKIPLOCKED, disableForUpdate ? readLoader : createEntityLoader(LockMode.UPGRADE_SKIPLOCKED));
    loaders.put(LockMode.FORCE, disableForUpdate ? readLoader : createEntityLoader(LockMode.FORCE));
    loaders.put(LockMode.PESSIMISTIC_READ, disableForUpdate ? readLoader : createEntityLoader(LockMode.PESSIMISTIC_READ));
    loaders.put(LockMode.PESSIMISTIC_WRITE, disableForUpdate ? readLoader : createEntityLoader(LockMode.PESSIMISTIC_WRITE));
    loaders.put(LockMode.PESSIMISTIC_FORCE_INCREMENT, disableForUpdate ? readLoader : createEntityLoader(LockMode.PESSIMISTIC_FORCE_INCREMENT));
    loaders.put(LockMode.OPTIMISTIC, createEntityLoader(LockMode.OPTIMISTIC));
    loaders.put(LockMode.OPTIMISTIC_FORCE_INCREMENT, createEntityLoader(LockMode.OPTIMISTIC_FORCE_INCREMENT));
    loaders.put("merge", new CascadeEntityLoader(this, CascadingActions.MERGE, getFactory()));
    loaders.put("refresh", new CascadeEntityLoader(this, CascadingActions.REFRESH, getFactory()));
}
Also used : UniqueEntityLoader(org.hibernate.loader.entity.UniqueEntityLoader) CascadeEntityLoader(org.hibernate.loader.entity.CascadeEntityLoader) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 CascadeEntityLoader (org.hibernate.loader.entity.CascadeEntityLoader)1 UniqueEntityLoader (org.hibernate.loader.entity.UniqueEntityLoader)1