
com.landawn.abacus.DBAccess Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2015 HaiYang Li
*
* Licensed 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 com.landawn.abacus;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.landawn.abacus.Transaction.Action;
import com.landawn.abacus.annotation.Internal;
import com.landawn.abacus.condition.Condition;
import com.landawn.abacus.exception.DuplicatedResultException;
import com.landawn.abacus.exception.InvalidTransactionIdException;
import com.landawn.abacus.metadata.EntityDefinitionFactory;
import com.landawn.abacus.util.u.Holder;
import com.landawn.abacus.util.u.Optional;
// TODO: Auto-generated Javadoc
/**
* This interface defines the basic APIs for data access between Java application and data store. Composed entities
* which have entity properties are not supported.
*
* @author Haiyang Li
* @since 0.8
*/
public interface DBAccess {
/**
* Find entity from data store by the specified {@code entityId}.
*
* @param
* @param entityId
* @return T
* @throws DuplicatedResultException if more than one record found by the specified {@code entityId}.
*/
Optional get(EntityId entityId) throws DuplicatedResultException;
/**
* Find entity from data store by the specified {@code entityId}.
*
* @param
* @param entityId
mes specifies the properties need to be load. all properties will be loaded if it's null.
* @return T
* @throws DuplicatedResultException if more than one record found by the specified {@code entityId}.
*/
Optional get(EntityId entityId, Collection selectPropNames) throws DuplicatedResultException;
/**
* Find entity from data store by the specified {@code entityId}.
*
* @param
* @param entityId
* @param selectPropNames specifies the properties need to be load. all properties will be loaded if it's null.
* @param options {@link com.landawn.abacus.util.Options}
* @return T
* @throws DuplicatedResultException if more than one record found by the specified {@code entityId}.
*/
Optional get(EntityId entityId, Collection selectPropNames, Map options) throws DuplicatedResultException;
/**
* Find entity from data store by the specified {@code entityId}.
*
* @param
* @param entityId
* @return T
* @throws DuplicatedResultException if more than one record found by the specified {@code entityId}.
*/
T gett(EntityId entityId) throws DuplicatedResultException;
/**
* Find entity from data store by the specified {@code entityId}.
*
* @param
* @param entityId
* @param selectPropNames specifies the properties need to be load. all properties will be loaded if it's null.
* @return T
* @throws DuplicatedResultException if more than one record found by the specified {@code entityId}.
*/
T gett(EntityId entityId, Collection selectPropNames) throws DuplicatedResultException;
/**
* Find entity from data store by the specified {@code entityId}.
*
* @param
* @param entityId
* @param selectPropNames specifies the properties need to be load. all properties will be loaded if it's null.
* @param options {@link com.landawn.abacus.util.Options}
* @return T
* @throws DuplicatedResultException if more than one record found by the specified {@code entityId}.
*/
T gett(EntityId entityId, Collection selectPropNames, Map options) throws DuplicatedResultException;
/**
*
* @param
* @param entityName
* @param selectPropNames
* @param condition
* @return
*/
List list(String entityName, Collection selectPropNames, Condition condition);
/**
*
* @param
* @param entityName
* @param selectPropNames
* @param condition
* @param options
* @return
*/
List list(String entityName, Collection selectPropNames, Condition condition, Map options);
/**
* Insert a new entity into data store.
*
* @param entityName
* @param props
* @param options supported option:{@code Tran.ID}.
* @return
*/
EntityId add(String entityName, Map props, Map options);
/**
* Insert entities into data store. If the size of element in the {@code propsList} is different, or the element has
* different properties, The vacancy property is inserted with {@code default} value.
*
* @param entityName
* @param propsList
* @param options {@link com.landawn.abacus.util.Options}
* @return List
*/
List addAll(String entityName, List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy