org.apache.ignite.cache.hibernate.HibernateAccessStrategyAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ignite-hibernate Show documentation
Show all versions of ignite-hibernate Show documentation
Java-based middleware for in-memory processing of big data in a distributed environment.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.cache.hibernate;
import org.apache.ignite.*;
import org.apache.ignite.cache.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.resources.*;
import org.hibernate.cache.*;
import org.hibernate.cache.spi.access.*;
import org.jetbrains.annotations.*;
import java.io.*;
/**
* Common interface used to implement Hibernate L2 cache access strategies ({@link RegionAccessStrategy},
* {@link EntityRegionAccessStrategy} and {@link CollectionRegionAccessStrategy}).
*
* The expected sequences of steps related to various CRUD operations executed by Hibernate are:
*
* Insert:
*
* - Start DB transaction.
* - Execute database insert.
* - Call {@link HibernateAccessStrategyAdapter#insert}.
* - Commit DB transaction.
* - Call {@link HibernateAccessStrategyAdapter#afterInsert}.
*
* In case if some step fails and DB transaction is rolled back then
* {@link HibernateAccessStrategyAdapter#afterInsert} is not called.
*
* Update:
*
* - Start DB transaction.
* - Call {@link HibernateAccessStrategyAdapter#lock}.
* - Execute database update.
* - Call {@link HibernateAccessStrategyAdapter#update}.
* - Commit DB transaction.
* - Call {@link HibernateAccessStrategyAdapter#afterUpdate}.
*
* In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
* transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
*
* Delete:
*
* - Start DB transaction.
* - Call {@link HibernateAccessStrategyAdapter#lock} for removing key.
* - Execute database delete.
* - Call {@link HibernateAccessStrategyAdapter#remove}.
* - Commit DB transaction.
* - Call {@link HibernateAccessStrategyAdapter#unlock}.
*
* In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
* transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
*
* In case if custom SQL update query is executed Hibernate clears entire cache region,
* for this case operations sequence is:
*
* - Start DB transaction.
* - Call {@link HibernateAccessStrategyAdapter#lockRegion}.
* - Execute database query.
* - Call {@link HibernateAccessStrategyAdapter#removeAll}.
* - Commit DB transaction.
* - Call {@link HibernateAccessStrategyAdapter#unlockRegion}.
*
*/
public abstract class HibernateAccessStrategyAdapter {
/** */
protected final GridCache
© 2015 - 2025 Weber Informatics LLC | Privacy Policy