|
@@ -0,0 +1,1662 @@
|
|
|
|
+/*
|
|
|
|
+ * Copyright 2009-2014 the CodeLibs Project and the Others.
|
|
|
|
+ *
|
|
|
|
+ * 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 jp.sf.fess.db.bsbhv;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import jp.sf.fess.db.bsbhv.loader.LoaderOfKeyMatch;
|
|
|
|
+import jp.sf.fess.db.bsentity.dbmeta.KeyMatchDbm;
|
|
|
|
+import jp.sf.fess.db.cbean.KeyMatchCB;
|
|
|
|
+import jp.sf.fess.db.exbhv.KeyMatchBhv;
|
|
|
|
+import jp.sf.fess.db.exentity.KeyMatch;
|
|
|
|
+
|
|
|
|
+import org.seasar.dbflute.Entity;
|
|
|
|
+import org.seasar.dbflute.bhv.AbstractBehaviorWritable;
|
|
|
|
+import org.seasar.dbflute.bhv.DeleteOption;
|
|
|
|
+import org.seasar.dbflute.bhv.InsertOption;
|
|
|
|
+import org.seasar.dbflute.bhv.QueryInsertSetupper;
|
|
|
|
+import org.seasar.dbflute.bhv.ReferrerLoaderHandler;
|
|
|
|
+import org.seasar.dbflute.bhv.UpdateOption;
|
|
|
|
+import org.seasar.dbflute.cbean.ConditionBean;
|
|
|
|
+import org.seasar.dbflute.cbean.EntityRowHandler;
|
|
|
|
+import org.seasar.dbflute.cbean.ListResultBean;
|
|
|
|
+import org.seasar.dbflute.cbean.PagingResultBean;
|
|
|
|
+import org.seasar.dbflute.cbean.SpecifyQuery;
|
|
|
|
+import org.seasar.dbflute.cbean.chelper.HpSLSExecutor;
|
|
|
|
+import org.seasar.dbflute.cbean.chelper.HpSLSFunction;
|
|
|
|
+import org.seasar.dbflute.dbmeta.DBMeta;
|
|
|
|
+import org.seasar.dbflute.exception.BatchEntityAlreadyUpdatedException;
|
|
|
|
+import org.seasar.dbflute.exception.DangerousResultSizeException;
|
|
|
|
+import org.seasar.dbflute.exception.EntityAlreadyDeletedException;
|
|
|
|
+import org.seasar.dbflute.exception.EntityAlreadyExistsException;
|
|
|
|
+import org.seasar.dbflute.exception.EntityAlreadyUpdatedException;
|
|
|
|
+import org.seasar.dbflute.exception.EntityDuplicatedException;
|
|
|
|
+import org.seasar.dbflute.exception.NonQueryDeleteNotAllowedException;
|
|
|
|
+import org.seasar.dbflute.exception.NonQueryUpdateNotAllowedException;
|
|
|
|
+import org.seasar.dbflute.exception.SelectEntityConditionNotFoundException;
|
|
|
|
+import org.seasar.dbflute.optional.OptionalEntity;
|
|
|
|
+import org.seasar.dbflute.outsidesql.executor.OutsideSqlBasicExecutor;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * The behavior of KEY_MATCH as TABLE. <br />
|
|
|
|
+ * <pre>
|
|
|
|
+ * [primary key]
|
|
|
|
+ * ID
|
|
|
|
+ *
|
|
|
|
+ * [column]
|
|
|
|
+ * ID, TERM, QUERY, MAX_SIZE, BOOST, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETED_BY, DELETED_TIME, VERSION_NO
|
|
|
|
+ *
|
|
|
|
+ * [sequence]
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * [identity]
|
|
|
|
+ * ID
|
|
|
|
+ *
|
|
|
|
+ * [version-no]
|
|
|
|
+ * VERSION_NO
|
|
|
|
+ *
|
|
|
|
+ * [foreign table]
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * [referrer table]
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * [foreign property]
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * [referrer property]
|
|
|
|
+ *
|
|
|
|
+ * </pre>
|
|
|
|
+ * @author DBFlute(AutoGenerator)
|
|
|
|
+ */
|
|
|
|
+public abstract class BsKeyMatchBhv extends AbstractBehaviorWritable {
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Definition
|
|
|
|
+ // ==========
|
|
|
|
+ /*df:beginQueryPath*/
|
|
|
|
+ /*df:endQueryPath*/
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Table name
|
|
|
|
+ // ==========
|
|
|
|
+ /** @return The name on database of table. (NotNull) */
|
|
|
|
+ @Override
|
|
|
|
+ public String getTableDbName() {
|
|
|
|
+ return "KEY_MATCH";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // DBMeta
|
|
|
|
+ // ======
|
|
|
|
+ /** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
|
|
+ public DBMeta getDBMeta() {
|
|
|
|
+ return KeyMatchDbm.getInstance();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /** @return The instance of DBMeta as my table type. (NotNull) */
|
|
|
|
+ public KeyMatchDbm getMyDBMeta() {
|
|
|
|
+ return KeyMatchDbm.getInstance();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // New Instance
|
|
|
|
+ // ============
|
|
|
|
+ /** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
|
|
+ public KeyMatch newEntity() {
|
|
|
|
+ return new KeyMatch();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
|
|
+ public KeyMatchCB newConditionBean() {
|
|
|
|
+ return new KeyMatchCB();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /** @return The instance of new entity as my table type. (NotNull) */
|
|
|
|
+ public KeyMatch newMyEntity() {
|
|
|
|
+ return new KeyMatch();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /** @return The instance of new condition-bean as my table type. (NotNull) */
|
|
|
|
+ public KeyMatchCB newMyConditionBean() {
|
|
|
|
+ return new KeyMatchCB();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Count Select
|
|
|
|
+ // ============
|
|
|
|
+ /**
|
|
|
|
+ * Select the count of uniquely-selected records by the condition-bean. {IgnorePagingCondition, IgnoreSpecifyColumn}<br />
|
|
|
|
+ * SpecifyColumn is ignored but you can use it only to remove text type column for union's distinct.
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * int count = keyMatchBhv.<span style="color: #DD4747">selectCount</span>(cb);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @return The count for the condition. (NotMinus)
|
|
|
|
+ */
|
|
|
|
+ public int selectCount(final KeyMatchCB cb) {
|
|
|
|
+ return facadeSelectCount(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int facadeSelectCount(final KeyMatchCB cb) {
|
|
|
|
+ return doSelectCountUniquely(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int doSelectCountUniquely(final KeyMatchCB cb) { // called by selectCount(cb)
|
|
|
|
+ assertCBStateValid(cb);
|
|
|
|
+ return delegateSelectCountUniquely(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int doSelectCountPlainly(final KeyMatchCB cb) { // called by selectPage(cb)
|
|
|
|
+ assertCBStateValid(cb);
|
|
|
|
+ return delegateSelectCountPlainly(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int doReadCount(final ConditionBean cb) {
|
|
|
|
+ return facadeSelectCount(downcast(cb));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Entity Select
|
|
|
|
+ // =============
|
|
|
|
+ /**
|
|
|
|
+ * Select the entity by the condition-bean. #beforejava8 <br />
|
|
|
|
+ * <span style="color: #AD4747; font-size: 120%">The return might be null if no data, so you should have null check.</span> <br />
|
|
|
|
+ * <span style="color: #AD4747; font-size: 120%">If the data always exists as your business rule, use selectEntityWithDeletedCheck().</span>
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * KeyMatch keyMatch = keyMatchBhv.<span style="color: #DD4747">selectEntity</span>(cb);
|
|
|
|
+ * if (keyMatch != null) { <span style="color: #3F7E5E">// null check</span>
|
|
|
|
+ * ... = keyMatch.get...();
|
|
|
|
+ * } else {
|
|
|
|
+ * ...
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @return The entity selected by the condition. (NullAllowed: if no data, it returns null)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
|
|
|
|
+ */
|
|
|
|
+ public KeyMatch selectEntity(final KeyMatchCB cb) {
|
|
|
|
+ return facadeSelectEntity(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatch facadeSelectEntity(final KeyMatchCB cb) {
|
|
|
|
+ return doSelectEntity(cb, typeOfSelectedEntity());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> ENTITY doSelectEntity(
|
|
|
|
+ final KeyMatchCB cb, final Class<ENTITY> tp) {
|
|
|
|
+ return helpSelectEntityInternally(cb, tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> OptionalEntity<ENTITY> doSelectOptionalEntity(
|
|
|
|
+ final KeyMatchCB cb, final Class<ENTITY> tp) {
|
|
|
|
+ return createOptionalEntity(doSelectEntity(cb, tp), cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected Entity doReadEntity(final ConditionBean cb) {
|
|
|
|
+ return facadeSelectEntity(downcast(cb));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Select the entity by the condition-bean with deleted check. <br />
|
|
|
|
+ * <span style="color: #AD4747; font-size: 120%">If the data always exists as your business rule, this method is good.</span>
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * KeyMatch keyMatch = keyMatchBhv.<span style="color: #DD4747">selectEntityWithDeletedCheck</span>(cb);
|
|
|
|
+ * ... = keyMatch.get...(); <span style="color: #3F7E5E">// the entity always be not null</span>
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @return The entity selected by the condition. (NotNull: if no data, throws exception)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
|
|
|
|
+ */
|
|
|
|
+ public KeyMatch selectEntityWithDeletedCheck(final KeyMatchCB cb) {
|
|
|
|
+ return facadeSelectEntityWithDeletedCheck(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatch facadeSelectEntityWithDeletedCheck(final KeyMatchCB cb) {
|
|
|
|
+ return doSelectEntityWithDeletedCheck(cb, typeOfSelectedEntity());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> ENTITY doSelectEntityWithDeletedCheck(
|
|
|
|
+ final KeyMatchCB cb, final Class<ENTITY> tp) {
|
|
|
|
+ assertCBStateValid(cb);
|
|
|
|
+ assertObjectNotNull("entityType", tp);
|
|
|
|
+ return helpSelectEntityWithDeletedCheckInternally(cb, tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected Entity doReadEntityWithDeletedCheck(final ConditionBean cb) {
|
|
|
|
+ return facadeSelectEntityWithDeletedCheck(downcast(cb));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Select the entity by the primary-key value.
|
|
|
|
+ * @param id : PK, ID, NotNull, BIGINT(19). (NotNull)
|
|
|
|
+ * @return The entity selected by the PK. (NullAllowed: if no data, it returns null)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
|
|
|
|
+ */
|
|
|
|
+ public KeyMatch selectByPKValue(final Long id) {
|
|
|
|
+ return facadeSelectByPKValue(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatch facadeSelectByPKValue(final Long id) {
|
|
|
|
+ return doSelectByPK(id, typeOfSelectedEntity());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> ENTITY doSelectByPK(final Long id,
|
|
|
|
+ final Class<ENTITY> tp) {
|
|
|
|
+ return doSelectEntity(xprepareCBAsPK(id), tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> OptionalEntity<ENTITY> doSelectOptionalByPK(
|
|
|
|
+ final Long id, final Class<ENTITY> tp) {
|
|
|
|
+ return createOptionalEntity(doSelectByPK(id, tp), id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Select the entity by the primary-key value with deleted check.
|
|
|
|
+ * @param id : PK, ID, NotNull, BIGINT(19). (NotNull)
|
|
|
|
+ * @return The entity selected by the PK. (NotNull: if no data, throws exception)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
|
|
|
|
+ */
|
|
|
|
+ public KeyMatch selectByPKValueWithDeletedCheck(final Long id) {
|
|
|
|
+ return doSelectByPKWithDeletedCheck(id, typeOfSelectedEntity());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> ENTITY doSelectByPKWithDeletedCheck(
|
|
|
|
+ final Long id, final Class<ENTITY> tp) {
|
|
|
|
+ return doSelectEntityWithDeletedCheck(xprepareCBAsPK(id), tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatchCB xprepareCBAsPK(final Long id) {
|
|
|
|
+ assertObjectNotNull("id", id);
|
|
|
|
+ return newConditionBean().acceptPK(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // List Select
|
|
|
|
+ // ===========
|
|
|
|
+ /**
|
|
|
|
+ * Select the list as result bean.
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * cb.query().addOrderBy_Bar...();
|
|
|
|
+ * ListResultBean<KeyMatch> keyMatchList = keyMatchBhv.<span style="color: #DD4747">selectList</span>(cb);
|
|
|
|
+ * for (KeyMatch keyMatch : keyMatchList) {
|
|
|
|
+ * ... = keyMatch.get...();
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @return The result bean of selected list. (NotNull: if no data, returns empty list)
|
|
|
|
+ * @exception DangerousResultSizeException When the result size is over the specified safety size.
|
|
|
|
+ */
|
|
|
|
+ public ListResultBean<KeyMatch> selectList(final KeyMatchCB cb) {
|
|
|
|
+ return facadeSelectList(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected ListResultBean<KeyMatch> facadeSelectList(final KeyMatchCB cb) {
|
|
|
|
+ return doSelectList(cb, typeOfSelectedEntity());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> ListResultBean<ENTITY> doSelectList(
|
|
|
|
+ final KeyMatchCB cb, final Class<ENTITY> tp) {
|
|
|
|
+ return helpSelectListInternally(cb, tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected ListResultBean<? extends Entity> doReadList(final ConditionBean cb) {
|
|
|
|
+ return facadeSelectList(downcast(cb));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Page Select
|
|
|
|
+ // ===========
|
|
|
|
+ /**
|
|
|
|
+ * Select the page as result bean. <br />
|
|
|
|
+ * (both count-select and paging-select are executed)
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * cb.query().addOrderBy_Bar...();
|
|
|
|
+ * cb.<span style="color: #DD4747">paging</span>(20, 3); <span style="color: #3F7E5E">// 20 records per a page and current page number is 3</span>
|
|
|
|
+ * PagingResultBean<KeyMatch> page = keyMatchBhv.<span style="color: #DD4747">selectPage</span>(cb);
|
|
|
|
+ * int allRecordCount = page.getAllRecordCount();
|
|
|
|
+ * int allPageCount = page.getAllPageCount();
|
|
|
|
+ * boolean isExistPrePage = page.isExistPrePage();
|
|
|
|
+ * boolean isExistNextPage = page.isExistNextPage();
|
|
|
|
+ * ...
|
|
|
|
+ * for (KeyMatch keyMatch : page) {
|
|
|
|
+ * ... = keyMatch.get...();
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @return The result bean of selected page. (NotNull: if no data, returns bean as empty list)
|
|
|
|
+ * @exception DangerousResultSizeException When the result size is over the specified safety size.
|
|
|
|
+ */
|
|
|
|
+ public PagingResultBean<KeyMatch> selectPage(final KeyMatchCB cb) {
|
|
|
|
+ return facadeSelectPage(cb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected PagingResultBean<KeyMatch> facadeSelectPage(final KeyMatchCB cb) {
|
|
|
|
+ return doSelectPage(cb, typeOfSelectedEntity());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> PagingResultBean<ENTITY> doSelectPage(
|
|
|
|
+ final KeyMatchCB cb, final Class<ENTITY> tp) {
|
|
|
|
+ return helpSelectPageInternally(cb, tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected PagingResultBean<? extends Entity> doReadPage(
|
|
|
|
+ final ConditionBean cb) {
|
|
|
|
+ return facadeSelectPage(downcast(cb));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Cursor Select
|
|
|
|
+ // =============
|
|
|
|
+ /**
|
|
|
|
+ * Select the cursor by the condition-bean.
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">selectCursor</span>(cb, new EntityRowHandler<KeyMatch>() {
|
|
|
|
+ * public void handle(KeyMatch entity) {
|
|
|
|
+ * ... = entity.getFoo...();
|
|
|
|
+ * }
|
|
|
|
+ * });
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @param entityRowHandler The handler of entity row of KeyMatch. (NotNull)
|
|
|
|
+ */
|
|
|
|
+ public void selectCursor(final KeyMatchCB cb,
|
|
|
|
+ final EntityRowHandler<KeyMatch> entityRowHandler) {
|
|
|
|
+ facadeSelectCursor(cb, entityRowHandler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void facadeSelectCursor(final KeyMatchCB cb,
|
|
|
|
+ final EntityRowHandler<KeyMatch> entityRowHandler) {
|
|
|
|
+ doSelectCursor(cb, entityRowHandler, typeOfSelectedEntity());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <ENTITY extends KeyMatch> void doSelectCursor(
|
|
|
|
+ final KeyMatchCB cb, final EntityRowHandler<ENTITY> handler,
|
|
|
|
+ final Class<ENTITY> tp) {
|
|
|
|
+ assertCBStateValid(cb);
|
|
|
|
+ assertObjectNotNull("entityRowHandler", handler);
|
|
|
|
+ assertObjectNotNull("entityType", tp);
|
|
|
|
+ assertSpecifyDerivedReferrerEntityProperty(cb, tp);
|
|
|
|
+ helpSelectCursorInternally(cb, handler, tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Scalar Select
|
|
|
|
+ // =============
|
|
|
|
+ /**
|
|
|
|
+ * Select the scalar value derived by a function from uniquely-selected records. <br />
|
|
|
|
+ * You should call a function method after this method called like as follows:
|
|
|
|
+ * <pre>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">scalarSelect</span>(Date.class).max(new ScalarQuery() {
|
|
|
|
+ * public void query(KeyMatchCB cb) {
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnFooDatetime()</span>; <span style="color: #3F7E5E">// required for a function</span>
|
|
|
|
+ * cb.query().setBarName_PrefixSearch("S");
|
|
|
|
+ * }
|
|
|
|
+ * });
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param <RESULT> The type of result.
|
|
|
|
+ * @param resultType The type of result. (NotNull)
|
|
|
|
+ * @return The scalar function object to specify function for scalar value. (NotNull)
|
|
|
|
+ */
|
|
|
|
+ public <RESULT> HpSLSFunction<KeyMatchCB, RESULT> scalarSelect(
|
|
|
|
+ final Class<RESULT> resultType) {
|
|
|
|
+ return facadeScalarSelect(resultType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <RESULT> HpSLSFunction<KeyMatchCB, RESULT> facadeScalarSelect(
|
|
|
|
+ final Class<RESULT> resultType) {
|
|
|
|
+ return doScalarSelect(resultType, newConditionBean());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected <RESULT, CB extends KeyMatchCB> HpSLSFunction<CB, RESULT> doScalarSelect(
|
|
|
|
+ final Class<RESULT> tp, final CB cb) {
|
|
|
|
+ assertObjectNotNull("resultType", tp);
|
|
|
|
+ assertCBStateValid(cb);
|
|
|
|
+ cb.xsetupForScalarSelect();
|
|
|
|
+ cb.getSqlClause().disableSelectIndex(); // for when you use union
|
|
|
|
+ final HpSLSExecutor<CB, RESULT> executor = createHpSLSExecutor(); // variable to resolve generic
|
|
|
|
+ return createSLSFunction(cb, tp, executor);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected <RESULT> HpSLSFunction<? extends ConditionBean, RESULT> doReadScalar(
|
|
|
|
+ final Class<RESULT> tp) {
|
|
|
|
+ return facadeScalarSelect(tp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Sequence
|
|
|
|
+ // ========
|
|
|
|
+ @Override
|
|
|
|
+ protected Number doReadNextVal() {
|
|
|
|
+ final String msg = "This table is NOT related to sequence: "
|
|
|
|
+ + getTableDbName();
|
|
|
|
+ throw new UnsupportedOperationException(msg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Load Referrer
|
|
|
|
+ // =============
|
|
|
|
+ /**
|
|
|
|
+ * Load referrer by the the referrer loader. <br />
|
|
|
|
+ * <pre>
|
|
|
|
+ * MemberCB cb = new MemberCB();
|
|
|
|
+ * cb.query().set...
|
|
|
|
+ * List<Member> memberList = memberBhv.selectList(cb);
|
|
|
|
+ * memberBhv.<span style="color: #DD4747">load</span>(memberList, loader -> {
|
|
|
|
+ * loader.<span style="color: #DD4747">loadPurchaseList</span>(purchaseCB -> {
|
|
|
|
+ * purchaseCB.query().set...
|
|
|
|
+ * purchaseCB.query().addOrderBy_PurchasePrice_Desc();
|
|
|
|
+ * }); <span style="color: #3F7E5E">// you can also load nested referrer from here</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//}).withNestedList(purchaseLoader -> {</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// purchaseLoader.loadPurchasePaymentList(...);</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//});</span>
|
|
|
|
+ *
|
|
|
|
+ * <span style="color: #3F7E5E">// you can also pull out foreign table and load its referrer</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (setupSelect of the foreign table should be called)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//loader.pulloutMemberStatus().loadMemberLoginList(...)</span>
|
|
|
|
+ * }
|
|
|
|
+ * for (Member member : memberList) {
|
|
|
|
+ * List<Purchase> purchaseList = member.<span style="color: #DD4747">getPurchaseList()</span>;
|
|
|
|
+ * for (Purchase purchase : purchaseList) {
|
|
|
|
+ * ...
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * About internal policy, the value of primary key (and others too) is treated as case-insensitive. <br />
|
|
|
|
+ * The condition-bean, which the set-upper provides, has order by FK before callback.
|
|
|
|
+ * @param keyMatchList The entity list of keyMatch. (NotNull)
|
|
|
|
+ * @param handler The callback to handle the referrer loader for actually loading referrer. (NotNull)
|
|
|
|
+ */
|
|
|
|
+ public void load(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final ReferrerLoaderHandler<LoaderOfKeyMatch> handler) {
|
|
|
|
+ xassLRArg(keyMatchList, handler);
|
|
|
|
+ handler.handle(new LoaderOfKeyMatch().ready(keyMatchList,
|
|
|
|
+ _behaviorSelector));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Load referrer of ${referrer.referrerJavaBeansRulePropertyName} by the referrer loader. <br />
|
|
|
|
+ * <pre>
|
|
|
|
+ * MemberCB cb = new MemberCB();
|
|
|
|
+ * cb.query().set...
|
|
|
|
+ * Member member = memberBhv.selectEntityWithDeletedCheck(cb);
|
|
|
|
+ * memberBhv.<span style="color: #DD4747">load</span>(member, loader -> {
|
|
|
|
+ * loader.<span style="color: #DD4747">loadPurchaseList</span>(purchaseCB -> {
|
|
|
|
+ * purchaseCB.query().set...
|
|
|
|
+ * purchaseCB.query().addOrderBy_PurchasePrice_Desc();
|
|
|
|
+ * }); <span style="color: #3F7E5E">// you can also load nested referrer from here</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//}).withNestedList(purchaseLoader -> {</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// purchaseLoader.loadPurchasePaymentList(...);</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//});</span>
|
|
|
|
+ *
|
|
|
|
+ * <span style="color: #3F7E5E">// you can also pull out foreign table and load its referrer</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (setupSelect of the foreign table should be called)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//loader.pulloutMemberStatus().loadMemberLoginList(...)</span>
|
|
|
|
+ * }
|
|
|
|
+ * for (Member member : memberList) {
|
|
|
|
+ * List<Purchase> purchaseList = member.<span style="color: #DD4747">getPurchaseList()</span>;
|
|
|
|
+ * for (Purchase purchase : purchaseList) {
|
|
|
|
+ * ...
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * About internal policy, the value of primary key (and others too) is treated as case-insensitive. <br />
|
|
|
|
+ * The condition-bean, which the set-upper provides, has order by FK before callback.
|
|
|
|
+ * @param keyMatch The entity of keyMatch. (NotNull)
|
|
|
|
+ * @param handler The callback to handle the referrer loader for actually loading referrer. (NotNull)
|
|
|
|
+ */
|
|
|
|
+ public void load(final KeyMatch keyMatch,
|
|
|
|
+ final ReferrerLoaderHandler<LoaderOfKeyMatch> handler) {
|
|
|
|
+ xassLRArg(keyMatch, handler);
|
|
|
|
+ handler.handle(new LoaderOfKeyMatch().ready(xnewLRAryLs(keyMatch),
|
|
|
|
+ _behaviorSelector));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Pull out Relation
|
|
|
|
+ // =================
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Extract Column
|
|
|
|
+ // ==============
|
|
|
|
+ /**
|
|
|
|
+ * Extract the value list of (single) primary key id.
|
|
|
|
+ * @param keyMatchList The list of keyMatch. (NotNull, EmptyAllowed)
|
|
|
|
+ * @return The list of the column value. (NotNull, EmptyAllowed, NotNullElement)
|
|
|
|
+ */
|
|
|
|
+ public List<Long> extractIdList(final List<KeyMatch> keyMatchList) {
|
|
|
|
+ return helpExtractListInternally(keyMatchList, "id");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Entity Update
|
|
|
|
+ // =============
|
|
|
|
+ /**
|
|
|
|
+ * Insert the entity modified-only. (DefaultConstraintsEnabled)
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * <span style="color: #3F7E5E">// if auto-increment, you don't need to set the PK value</span>
|
|
|
|
+ * keyMatch.setFoo...(value);
|
|
|
|
+ * keyMatch.setBar...(value);
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setRegisterUser(value);</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.set...;</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">insert</span>(keyMatch);
|
|
|
|
+ * ... = keyMatch.getPK...(); <span style="color: #3F7E5E">// if auto-increment, you can get the value after</span>
|
|
|
|
+ * </pre>
|
|
|
|
+ * <p>While, when the entity is created by select, all columns are registered.</p>
|
|
|
|
+ * @param keyMatch The entity of insert. (NotNull, PrimaryKeyNullAllowed: when auto-increment)
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void insert(final KeyMatch keyMatch) {
|
|
|
|
+ doInsert(keyMatch, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doInsert(final KeyMatch et, final InsertOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ prepareInsertOption(op);
|
|
|
|
+ delegateInsert(et, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void prepareInsertOption(final InsertOption<KeyMatchCB> op) {
|
|
|
|
+ if (op == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ assertInsertOptionStatus(op);
|
|
|
|
+ if (op.hasSpecifiedInsertColumn()) {
|
|
|
|
+ op.resolveInsertColumnSpecification(createCBForSpecifiedUpdate());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void doCreate(final Entity et,
|
|
|
|
+ final InsertOption<? extends ConditionBean> op) {
|
|
|
|
+ doInsert(downcast(et), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Update the entity modified-only. (ZeroUpdateException, ExclusiveControl)
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setPK...(value); <span style="color: #3F7E5E">// required</span>
|
|
|
|
+ * keyMatch.setFoo...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setRegisterUser(value);</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.set...;</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// if exclusive control, the value of concurrency column is required</span>
|
|
|
|
+ * keyMatch.<span style="color: #DD4747">setVersionNo</span>(value);
|
|
|
|
+ * try {
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">update</span>(keyMatch);
|
|
|
|
+ * } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span>
|
|
|
|
+ * ...
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of update. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnNotNull)
|
|
|
|
+ * @exception EntityAlreadyUpdatedException When the entity has already been updated.
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void update(final KeyMatch keyMatch) {
|
|
|
|
+ doUpdate(keyMatch, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doUpdate(final KeyMatch et, final UpdateOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ prepareUpdateOption(op);
|
|
|
|
+ helpUpdateInternally(et, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void prepareUpdateOption(final UpdateOption<KeyMatchCB> op) {
|
|
|
|
+ if (op == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ assertUpdateOptionStatus(op);
|
|
|
|
+ if (op.hasSelfSpecification()) {
|
|
|
|
+ op.resolveSelfSpecification(createCBForVaryingUpdate());
|
|
|
|
+ }
|
|
|
|
+ if (op.hasSpecifiedUpdateColumn()) {
|
|
|
|
+ op.resolveUpdateColumnSpecification(createCBForSpecifiedUpdate());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatchCB createCBForVaryingUpdate() {
|
|
|
|
+ final KeyMatchCB cb = newConditionBean();
|
|
|
|
+ cb.xsetupForVaryingUpdate();
|
|
|
|
+ return cb;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatchCB createCBForSpecifiedUpdate() {
|
|
|
|
+ final KeyMatchCB cb = newConditionBean();
|
|
|
|
+ cb.xsetupForSpecifiedUpdate();
|
|
|
|
+ return cb;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void doModify(final Entity et,
|
|
|
|
+ final UpdateOption<? extends ConditionBean> op) {
|
|
|
|
+ doUpdate(downcast(et), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Update the entity non-strictly modified-only. (ZeroUpdateException, NonExclusiveControl)
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setPK...(value); <span style="color: #3F7E5E">// required</span>
|
|
|
|
+ * keyMatch.setFoo...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setRegisterUser(value);</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.set...;</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set a value of concurrency column</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setVersionNo(value);</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">updateNonstrict</span>(keyMatch);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of update. (NotNull, PrimaryKeyNotNull)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void updateNonstrict(final KeyMatch keyMatch) {
|
|
|
|
+ doUpdateNonstrict(keyMatch, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doUpdateNonstrict(final KeyMatch et,
|
|
|
|
+ final UpdateOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ prepareUpdateOption(op);
|
|
|
|
+ helpUpdateNonstrictInternally(et, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void doModifyNonstrict(final Entity et,
|
|
|
|
+ final UpdateOption<? extends ConditionBean> op) {
|
|
|
|
+ doUpdateNonstrict(downcast(et), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Insert or update the entity modified-only. (DefaultConstraintsEnabled, ExclusiveControl) <br />
|
|
|
|
+ * if (the entity has no PK) { insert() } else { update(), but no data, insert() } <br />
|
|
|
|
+ * <p><span style="color: #DD4747; font-size: 120%">Attention, you cannot update by unique keys instead of PK.</span></p>
|
|
|
|
+ * @param keyMatch The entity of insert or update. (NotNull, ...depends on insert or update)
|
|
|
|
+ * @exception EntityAlreadyUpdatedException When the entity has already been updated.
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void insertOrUpdate(final KeyMatch keyMatch) {
|
|
|
|
+ doInsertOrUpdate(keyMatch, null, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doInsertOrUpdate(final KeyMatch et,
|
|
|
|
+ final InsertOption<KeyMatchCB> iop,
|
|
|
|
+ final UpdateOption<KeyMatchCB> uop) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ helpInsertOrUpdateInternally(et, iop, uop);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void doCreateOrModify(final Entity et,
|
|
|
|
+ final InsertOption<? extends ConditionBean> iop,
|
|
|
|
+ final UpdateOption<? extends ConditionBean> uop) {
|
|
|
|
+ doInsertOrUpdate(downcast(et), downcast(iop), downcast(uop));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Insert or update the entity non-strictly modified-only. (DefaultConstraintsEnabled, NonExclusiveControl) <br />
|
|
|
|
+ * if (the entity has no PK) { insert() } else { update(), but no data, insert() }
|
|
|
|
+ * <p><span style="color: #DD4747; font-size: 120%">Attention, you cannot update by unique keys instead of PK.</span></p>
|
|
|
|
+ * @param keyMatch The entity of insert or update. (NotNull, ...depends on insert or update)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void insertOrUpdateNonstrict(final KeyMatch keyMatch) {
|
|
|
|
+ doInsertOrUpdateNonstrict(keyMatch, null, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doInsertOrUpdateNonstrict(final KeyMatch et,
|
|
|
|
+ final InsertOption<KeyMatchCB> iop,
|
|
|
|
+ final UpdateOption<KeyMatchCB> uop) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ helpInsertOrUpdateNonstrictInternally(et, iop, uop);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void doCreateOrModifyNonstrict(final Entity et,
|
|
|
|
+ final InsertOption<? extends ConditionBean> iop,
|
|
|
|
+ final UpdateOption<? extends ConditionBean> uop) {
|
|
|
|
+ doInsertOrUpdateNonstrict(downcast(et), downcast(iop), downcast(uop));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Delete the entity. (ZeroUpdateException, ExclusiveControl)
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setPK...(value); <span style="color: #3F7E5E">// required</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// if exclusive control, the value of concurrency column is required</span>
|
|
|
|
+ * keyMatch.<span style="color: #DD4747">setVersionNo</span>(value);
|
|
|
|
+ * try {
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">delete</span>(keyMatch);
|
|
|
|
+ * } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span>
|
|
|
|
+ * ...
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of delete. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnNotNull)
|
|
|
|
+ * @exception EntityAlreadyUpdatedException When the entity has already been updated.
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ */
|
|
|
|
+ public void delete(final KeyMatch keyMatch) {
|
|
|
|
+ doDelete(keyMatch, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doDelete(final KeyMatch et, final DeleteOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ prepareDeleteOption(op);
|
|
|
|
+ helpDeleteInternally(et, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void prepareDeleteOption(final DeleteOption<KeyMatchCB> op) {
|
|
|
|
+ if (op != null) {
|
|
|
|
+ assertDeleteOptionStatus(op);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void doRemove(final Entity et,
|
|
|
|
+ final DeleteOption<? extends ConditionBean> op) {
|
|
|
|
+ doDelete(downcast(et), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Delete the entity non-strictly. {ZeroUpdateException, NonExclusiveControl}
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setPK...(value); <span style="color: #3F7E5E">// required</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set a value of concurrency column</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setVersionNo(value);</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">deleteNonstrict</span>(keyMatch);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of delete. (NotNull, PrimaryKeyNotNull)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ */
|
|
|
|
+ public void deleteNonstrict(final KeyMatch keyMatch) {
|
|
|
|
+ doDeleteNonstrict(keyMatch, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doDeleteNonstrict(final KeyMatch et,
|
|
|
|
+ final DeleteOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ prepareDeleteOption(op);
|
|
|
|
+ helpDeleteNonstrictInternally(et, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Delete the entity non-strictly ignoring deleted. {ZeroUpdateException, NonExclusiveControl}
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setPK...(value); <span style="color: #3F7E5E">// required</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set a value of concurrency column</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setVersionNo(value);</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">deleteNonstrictIgnoreDeleted</span>(keyMatch);
|
|
|
|
+ * <span style="color: #3F7E5E">// if the target entity doesn't exist, no exception</span>
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of delete. (NotNull, PrimaryKeyNotNull)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ */
|
|
|
|
+ public void deleteNonstrictIgnoreDeleted(final KeyMatch keyMatch) {
|
|
|
|
+ doDeleteNonstrictIgnoreDeleted(keyMatch, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void doDeleteNonstrictIgnoreDeleted(final KeyMatch et,
|
|
|
|
+ final DeleteOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ prepareDeleteOption(op);
|
|
|
|
+ helpDeleteNonstrictIgnoreDeletedInternally(et, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void doRemoveNonstrict(final Entity et,
|
|
|
|
+ final DeleteOption<? extends ConditionBean> op) {
|
|
|
|
+ doDeleteNonstrict(downcast(et), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Batch Update
|
|
|
|
+ // ============
|
|
|
|
+ /**
|
|
|
|
+ * Batch-insert the entity list modified-only of same-set columns. (DefaultConstraintsEnabled) <br />
|
|
|
|
+ * This method uses executeBatch() of java.sql.PreparedStatement. <br />
|
|
|
|
+ * <p><span style="color: #DD4747; font-size: 120%">The columns of least common multiple are registered like this:</span></p>
|
|
|
|
+ * <pre>
|
|
|
|
+ * for (... : ...) {
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setFooName("foo");
|
|
|
|
+ * if (...) {
|
|
|
|
+ * keyMatch.setFooPrice(123);
|
|
|
|
+ * }
|
|
|
|
+ * <span style="color: #3F7E5E">// FOO_NAME and FOO_PRICE (and record meta columns) are registered</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// FOO_PRICE not-called in any entities are registered as null without default value</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// columns not-called in all entities are registered as null or default value</span>
|
|
|
|
+ * keyMatchList.add(keyMatch);
|
|
|
|
+ * }
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">batchInsert</span>(keyMatchList);
|
|
|
|
+ * </pre>
|
|
|
|
+ * <p>While, when the entities are created by select, all columns are registered.</p>
|
|
|
|
+ * <p>And if the table has an identity, entities after the process don't have incremented values.
|
|
|
|
+ * (When you use the (normal) insert(), you can get the incremented value from your entity)</p>
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNullAllowed: when auto-increment)
|
|
|
|
+ * @return The array of inserted count. (NotNull, EmptyAllowed)
|
|
|
|
+ */
|
|
|
|
+ public int[] batchInsert(final List<KeyMatch> keyMatchList) {
|
|
|
|
+ return doBatchInsert(keyMatchList, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int[] doBatchInsert(final List<KeyMatch> ls,
|
|
|
|
+ final InsertOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatchList", ls);
|
|
|
|
+ InsertOption<KeyMatchCB> rlop;
|
|
|
|
+ if (op != null) {
|
|
|
|
+ rlop = op;
|
|
|
|
+ } else {
|
|
|
|
+ rlop = createPlainInsertOption();
|
|
|
|
+ }
|
|
|
|
+ prepareBatchInsertOption(ls, rlop); // required
|
|
|
|
+ return delegateBatchInsert(ls, rlop);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void prepareBatchInsertOption(final List<KeyMatch> ls,
|
|
|
|
+ final InsertOption<KeyMatchCB> op) {
|
|
|
|
+ op.xallowInsertColumnModifiedPropertiesFragmented();
|
|
|
|
+ op.xacceptInsertColumnModifiedPropertiesIfNeeds(ls);
|
|
|
|
+ prepareInsertOption(op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int[] doLumpCreate(final List<Entity> ls,
|
|
|
|
+ final InsertOption<? extends ConditionBean> op) {
|
|
|
|
+ return doBatchInsert(downcast(ls), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-update the entity list modified-only of same-set columns. (ExclusiveControl) <br />
|
|
|
|
+ * This method uses executeBatch() of java.sql.PreparedStatement. <br />
|
|
|
|
+ * <span style="color: #DD4747; font-size: 120%">You should specify same-set columns to all entities like this:</span>
|
|
|
|
+ * <pre>
|
|
|
|
+ * for (... : ...) {
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setFooName("foo");
|
|
|
|
+ * if (...) {
|
|
|
|
+ * keyMatch.setFooPrice(123);
|
|
|
|
+ * } else {
|
|
|
|
+ * keyMatch.setFooPrice(null); <span style="color: #3F7E5E">// updated as null</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setFooDate(...); // *not allowed, fragmented</span>
|
|
|
|
+ * }
|
|
|
|
+ * <span style="color: #3F7E5E">// FOO_NAME and FOO_PRICE (and record meta columns) are updated</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (others are not updated: their values are kept)</span>
|
|
|
|
+ * keyMatchList.add(keyMatch);
|
|
|
|
+ * }
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">batchUpdate</span>(keyMatchList);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull, ConcurrencyColumnNotNull)
|
|
|
|
+ * @return The array of updated count. (NotNull, EmptyAllowed)
|
|
|
|
+ * @exception BatchEntityAlreadyUpdatedException When the entity has already been updated. This exception extends EntityAlreadyUpdatedException.
|
|
|
|
+ */
|
|
|
|
+ public int[] batchUpdate(final List<KeyMatch> keyMatchList) {
|
|
|
|
+ return doBatchUpdate(keyMatchList, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int[] doBatchUpdate(final List<KeyMatch> ls,
|
|
|
|
+ final UpdateOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatchList", ls);
|
|
|
|
+ UpdateOption<KeyMatchCB> rlop;
|
|
|
|
+ if (op != null) {
|
|
|
|
+ rlop = op;
|
|
|
|
+ } else {
|
|
|
|
+ rlop = createPlainUpdateOption();
|
|
|
|
+ }
|
|
|
|
+ prepareBatchUpdateOption(ls, rlop); // required
|
|
|
|
+ return delegateBatchUpdate(ls, rlop);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void prepareBatchUpdateOption(final List<KeyMatch> ls,
|
|
|
|
+ final UpdateOption<KeyMatchCB> op) {
|
|
|
|
+ op.xacceptUpdateColumnModifiedPropertiesIfNeeds(ls);
|
|
|
|
+ prepareUpdateOption(op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int[] doLumpModify(final List<Entity> ls,
|
|
|
|
+ final UpdateOption<? extends ConditionBean> op) {
|
|
|
|
+ return doBatchUpdate(downcast(ls), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-update the entity list specified-only. (ExclusiveControl) <br />
|
|
|
|
+ * This method uses executeBatch() of java.sql.PreparedStatement.
|
|
|
|
+ * <pre>
|
|
|
|
+ * <span style="color: #3F7E5E">// e.g. update two columns only</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">batchUpdate</span>(keyMatchList, new SpecifyQuery<KeyMatchCB>() {
|
|
|
|
+ * public void specify(KeyMatchCB cb) { <span style="color: #3F7E5E">// the two only updated</span>
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnFooStatusCode()</span>; <span style="color: #3F7E5E">// should be modified in any entities</span>
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnBarDate()</span>; <span style="color: #3F7E5E">// should be modified in any entities</span>
|
|
|
|
+ * }
|
|
|
|
+ * });
|
|
|
|
+ * <span style="color: #3F7E5E">// e.g. update every column in the table</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">batchUpdate</span>(keyMatchList, new SpecifyQuery<KeyMatchCB>() {
|
|
|
|
+ * public void specify(KeyMatchCB cb) { <span style="color: #3F7E5E">// all columns are updated</span>
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnEveryColumn()</span>; <span style="color: #3F7E5E">// no check of modified properties</span>
|
|
|
|
+ * }
|
|
|
|
+ * });
|
|
|
|
+ * </pre>
|
|
|
|
+ * <p>You can specify update columns used on set clause of update statement.
|
|
|
|
+ * However you do not need to specify common columns for update
|
|
|
|
+ * and an optimistic lock column because they are specified implicitly.</p>
|
|
|
|
+ * <p>And you should specify columns that are modified in any entities (at least one entity).
|
|
|
|
+ * But if you specify every column, it has no check.</p>
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull, ConcurrencyColumnNotNull)
|
|
|
|
+ * @param updateColumnSpec The specification of update columns. (NotNull)
|
|
|
|
+ * @return The array of updated count. (NotNull, EmptyAllowed)
|
|
|
|
+ * @exception BatchEntityAlreadyUpdatedException When the entity has already been updated. This exception extends EntityAlreadyUpdatedException.
|
|
|
|
+ */
|
|
|
|
+ public int[] batchUpdate(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final SpecifyQuery<KeyMatchCB> updateColumnSpec) {
|
|
|
|
+ return doBatchUpdate(keyMatchList,
|
|
|
|
+ createSpecifiedUpdateOption(updateColumnSpec));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-update the entity list non-strictly modified-only of same-set columns. (NonExclusiveControl) <br />
|
|
|
|
+ * This method uses executeBatch() of java.sql.PreparedStatement. <br />
|
|
|
|
+ * <span style="color: #DD4747; font-size: 140%">You should specify same-set columns to all entities like this:</span>
|
|
|
|
+ * <pre>
|
|
|
|
+ * for (... : ...) {
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setFooName("foo");
|
|
|
|
+ * if (...) {
|
|
|
|
+ * keyMatch.setFooPrice(123);
|
|
|
|
+ * } else {
|
|
|
|
+ * keyMatch.setFooPrice(null); <span style="color: #3F7E5E">// updated as null</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setFooDate(...); // *not allowed, fragmented</span>
|
|
|
|
+ * }
|
|
|
|
+ * <span style="color: #3F7E5E">// FOO_NAME and FOO_PRICE (and record meta columns) are updated</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (others are not updated: their values are kept)</span>
|
|
|
|
+ * keyMatchList.add(keyMatch);
|
|
|
|
+ * }
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">batchUpdate</span>(keyMatchList);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @return The array of updated count. (NotNull, EmptyAllowed)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ */
|
|
|
|
+ public int[] batchUpdateNonstrict(final List<KeyMatch> keyMatchList) {
|
|
|
|
+ return doBatchUpdateNonstrict(keyMatchList, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int[] doBatchUpdateNonstrict(final List<KeyMatch> ls,
|
|
|
|
+ final UpdateOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatchList", ls);
|
|
|
|
+ UpdateOption<KeyMatchCB> rlop;
|
|
|
|
+ if (op != null) {
|
|
|
|
+ rlop = op;
|
|
|
|
+ } else {
|
|
|
|
+ rlop = createPlainUpdateOption();
|
|
|
|
+ }
|
|
|
|
+ prepareBatchUpdateOption(ls, rlop);
|
|
|
|
+ return delegateBatchUpdateNonstrict(ls, rlop);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-update the entity list non-strictly specified-only. (NonExclusiveControl) <br />
|
|
|
|
+ * This method uses executeBatch() of java.sql.PreparedStatement.
|
|
|
|
+ * <pre>
|
|
|
|
+ * <span style="color: #3F7E5E">// e.g. update two columns only</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">batchUpdateNonstrict</span>(keyMatchList, new SpecifyQuery<KeyMatchCB>() {
|
|
|
|
+ * public void specify(KeyMatchCB cb) { <span style="color: #3F7E5E">// the two only updated</span>
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnFooStatusCode()</span>; <span style="color: #3F7E5E">// should be modified in any entities</span>
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnBarDate()</span>; <span style="color: #3F7E5E">// should be modified in any entities</span>
|
|
|
|
+ * }
|
|
|
|
+ * });
|
|
|
|
+ * <span style="color: #3F7E5E">// e.g. update every column in the table</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">batchUpdateNonstrict</span>(keyMatchList, new SpecifyQuery<KeyMatchCB>() {
|
|
|
|
+ * public void specify(KeyMatchCB cb) { <span style="color: #3F7E5E">// all columns are updated</span>
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnEveryColumn()</span>; <span style="color: #3F7E5E">// no check of modified properties</span>
|
|
|
|
+ * }
|
|
|
|
+ * });
|
|
|
|
+ * </pre>
|
|
|
|
+ * <p>You can specify update columns used on set clause of update statement.
|
|
|
|
+ * However you do not need to specify common columns for update
|
|
|
|
+ * and an optimistic lock column because they are specified implicitly.</p>
|
|
|
|
+ * <p>And you should specify columns that are modified in any entities (at least one entity).</p>
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @param updateColumnSpec The specification of update columns. (NotNull)
|
|
|
|
+ * @return The array of updated count. (NotNull, EmptyAllowed)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ */
|
|
|
|
+ public int[] batchUpdateNonstrict(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final SpecifyQuery<KeyMatchCB> updateColumnSpec) {
|
|
|
|
+ return doBatchUpdateNonstrict(keyMatchList,
|
|
|
|
+ createSpecifiedUpdateOption(updateColumnSpec));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int[] doLumpModifyNonstrict(final List<Entity> ls,
|
|
|
|
+ final UpdateOption<? extends ConditionBean> op) {
|
|
|
|
+ return doBatchUpdateNonstrict(downcast(ls), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-delete the entity list. (ExclusiveControl) <br />
|
|
|
|
+ * This method uses executeBatch() of java.sql.PreparedStatement.
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @return The array of deleted count. (NotNull, EmptyAllowed)
|
|
|
|
+ * @exception BatchEntityAlreadyUpdatedException When the entity has already been updated. This exception extends EntityAlreadyUpdatedException.
|
|
|
|
+ */
|
|
|
|
+ public int[] batchDelete(final List<KeyMatch> keyMatchList) {
|
|
|
|
+ return doBatchDelete(keyMatchList, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int[] doBatchDelete(final List<KeyMatch> ls,
|
|
|
|
+ final DeleteOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatchList", ls);
|
|
|
|
+ prepareDeleteOption(op);
|
|
|
|
+ return delegateBatchDelete(ls, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int[] doLumpRemove(final List<Entity> ls,
|
|
|
|
+ final DeleteOption<? extends ConditionBean> op) {
|
|
|
|
+ return doBatchDelete(downcast(ls), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-delete the entity list non-strictly. {NonExclusiveControl} <br />
|
|
|
|
+ * This method uses executeBatch() of java.sql.PreparedStatement.
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @return The array of deleted count. (NotNull, EmptyAllowed)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ */
|
|
|
|
+ public int[] batchDeleteNonstrict(final List<KeyMatch> keyMatchList) {
|
|
|
|
+ return doBatchDeleteNonstrict(keyMatchList, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int[] doBatchDeleteNonstrict(final List<KeyMatch> ls,
|
|
|
|
+ final DeleteOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatchList", ls);
|
|
|
|
+ prepareDeleteOption(op);
|
|
|
|
+ return delegateBatchDeleteNonstrict(ls, op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int[] doLumpRemoveNonstrict(final List<Entity> ls,
|
|
|
|
+ final DeleteOption<? extends ConditionBean> op) {
|
|
|
|
+ return doBatchDeleteNonstrict(downcast(ls), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Query Update
|
|
|
|
+ // ============
|
|
|
|
+ /**
|
|
|
|
+ * Insert the several entities by query (modified-only for fixed value).
|
|
|
|
+ * <pre>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">queryInsert</span>(new QueryInsertSetupper<KeyMatch, KeyMatchCB>() {
|
|
|
|
+ * public ConditionBean setup(keyMatch entity, KeyMatchCB intoCB) {
|
|
|
|
+ * FooCB cb = FooCB();
|
|
|
|
+ * cb.setupSelect_Bar();
|
|
|
|
+ *
|
|
|
|
+ * <span style="color: #3F7E5E">// mapping</span>
|
|
|
|
+ * intoCB.specify().columnMyName().mappedFrom(cb.specify().columnFooName());
|
|
|
|
+ * intoCB.specify().columnMyCount().mappedFrom(cb.specify().columnFooCount());
|
|
|
|
+ * intoCB.specify().columnMyDate().mappedFrom(cb.specify().specifyBar().columnBarDate());
|
|
|
|
+ * entity.setMyFixedValue("foo"); <span style="color: #3F7E5E">// fixed value</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//entity.setRegisterUser(value);</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//entity.set...;</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set a value of concurrency column</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//entity.setVersionNo(value);</span>
|
|
|
|
+ *
|
|
|
|
+ * return cb;
|
|
|
|
+ * }
|
|
|
|
+ * });
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param setupper The setup-per of query-insert. (NotNull)
|
|
|
|
+ * @return The inserted count.
|
|
|
|
+ */
|
|
|
|
+ public int queryInsert(
|
|
|
|
+ final QueryInsertSetupper<KeyMatch, KeyMatchCB> setupper) {
|
|
|
|
+ return doQueryInsert(setupper, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int doQueryInsert(
|
|
|
|
+ final QueryInsertSetupper<KeyMatch, KeyMatchCB> sp,
|
|
|
|
+ final InsertOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("setupper", sp);
|
|
|
|
+ prepareInsertOption(op);
|
|
|
|
+ final KeyMatch et = newEntity();
|
|
|
|
+ final KeyMatchCB cb = createCBForQueryInsert();
|
|
|
|
+ return delegateQueryInsert(et, cb, sp.setup(et, cb), op);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatchCB createCBForQueryInsert() {
|
|
|
|
+ final KeyMatchCB cb = newConditionBean();
|
|
|
|
+ cb.xsetupForQueryInsert();
|
|
|
|
+ return cb;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int doRangeCreate(
|
|
|
|
+ final QueryInsertSetupper<? extends Entity, ? extends ConditionBean> setupper,
|
|
|
|
+ final InsertOption<? extends ConditionBean> op) {
|
|
|
|
+ return doQueryInsert(downcast(setupper), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Update the several entities by query non-strictly modified-only. (NonExclusiveControl)
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set PK value</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setPK...(value);</span>
|
|
|
|
+ * keyMatch.setFoo...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setRegisterUser(value);</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.set...;</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set a value of concurrency column</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setVersionNo(value);</span>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">queryUpdate</span>(keyMatch, cb);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity that contains update values. (NotNull, PrimaryKeyNullAllowed)
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @return The updated count.
|
|
|
|
+ * @exception NonQueryUpdateNotAllowedException When the query has no condition.
|
|
|
|
+ */
|
|
|
|
+ public int queryUpdate(final KeyMatch keyMatch, final KeyMatchCB cb) {
|
|
|
|
+ return doQueryUpdate(keyMatch, cb, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int doQueryUpdate(final KeyMatch et, final KeyMatchCB cb,
|
|
|
|
+ final UpdateOption<KeyMatchCB> op) {
|
|
|
|
+ assertObjectNotNull("keyMatch", et);
|
|
|
|
+ assertCBStateValid(cb);
|
|
|
|
+ prepareUpdateOption(op);
|
|
|
|
+ return checkCountBeforeQueryUpdateIfNeeds(cb) ? delegateQueryUpdate(et,
|
|
|
|
+ cb, op) : 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int doRangeModify(final Entity et, final ConditionBean cb,
|
|
|
|
+ final UpdateOption<? extends ConditionBean> op) {
|
|
|
|
+ return doQueryUpdate(downcast(et), downcast(cb), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Delete the several entities by query. (NonExclusiveControl)
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">queryDelete</span>(keyMatch, cb);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @return The deleted count.
|
|
|
|
+ * @exception NonQueryDeleteNotAllowedException When the query has no condition.
|
|
|
|
+ */
|
|
|
|
+ public int queryDelete(final KeyMatchCB cb) {
|
|
|
|
+ return doQueryDelete(cb, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected int doQueryDelete(final KeyMatchCB cb,
|
|
|
|
+ final DeleteOption<KeyMatchCB> op) {
|
|
|
|
+ assertCBStateValid(cb);
|
|
|
|
+ prepareDeleteOption(op);
|
|
|
|
+ return checkCountBeforeQueryUpdateIfNeeds(cb) ? delegateQueryDelete(cb,
|
|
|
|
+ op) : 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int doRangeRemove(final ConditionBean cb,
|
|
|
|
+ final DeleteOption<? extends ConditionBean> op) {
|
|
|
|
+ return doQueryDelete(downcast(cb), downcast(op));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Varying Update
|
|
|
|
+ // ==============
|
|
|
|
+ // -----------------------------------------------------
|
|
|
|
+ // Entity Update
|
|
|
|
+ // -------------
|
|
|
|
+ /**
|
|
|
|
+ * Insert the entity with varying requests. <br />
|
|
|
|
+ * For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity(). <br />
|
|
|
|
+ * Other specifications are same as insert(entity).
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * <span style="color: #3F7E5E">// if auto-increment, you don't need to set the PK value</span>
|
|
|
|
+ * keyMatch.setFoo...(value);
|
|
|
|
+ * keyMatch.setBar...(value);
|
|
|
|
+ * InsertOption<KeyMatchCB> option = new InsertOption<KeyMatchCB>();
|
|
|
|
+ * <span style="color: #3F7E5E">// you can insert by your values for common columns</span>
|
|
|
|
+ * option.disableCommonColumnAutoSetup();
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">varyingInsert</span>(keyMatch, option);
|
|
|
|
+ * ... = keyMatch.getPK...(); <span style="color: #3F7E5E">// if auto-increment, you can get the value after</span>
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of insert. (NotNull, PrimaryKeyNullAllowed: when auto-increment)
|
|
|
|
+ * @param option The option of insert for varying requests. (NotNull)
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void varyingInsert(final KeyMatch keyMatch,
|
|
|
|
+ final InsertOption<KeyMatchCB> option) {
|
|
|
|
+ assertInsertOptionNotNull(option);
|
|
|
|
+ doInsert(keyMatch, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Update the entity with varying requests modified-only. (ZeroUpdateException, ExclusiveControl) <br />
|
|
|
|
+ * For example, self(selfCalculationSpecification), specify(updateColumnSpecification), disableCommonColumnAutoSetup(). <br />
|
|
|
|
+ * Other specifications are same as update(entity).
|
|
|
|
+ * <pre>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setPK...(value); <span style="color: #3F7E5E">// required</span>
|
|
|
|
+ * keyMatch.setOther...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// if exclusive control, the value of concurrency column is required</span>
|
|
|
|
+ * keyMatch.<span style="color: #DD4747">setVersionNo</span>(value);
|
|
|
|
+ * try {
|
|
|
|
+ * <span style="color: #3F7E5E">// you can update by self calculation values</span>
|
|
|
|
+ * UpdateOption<KeyMatchCB> option = new UpdateOption<KeyMatchCB>();
|
|
|
|
+ * option.self(new SpecifyQuery<KeyMatchCB>() {
|
|
|
|
+ * public void specify(KeyMatchCB cb) {
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnXxxCount()</span>;
|
|
|
|
+ * }
|
|
|
|
+ * }).plus(1); <span style="color: #3F7E5E">// XXX_COUNT = XXX_COUNT + 1</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">varyingUpdate</span>(keyMatch, option);
|
|
|
|
+ * } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span>
|
|
|
|
+ * ...
|
|
|
|
+ * }
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of update. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnNotNull)
|
|
|
|
+ * @param option The option of update for varying requests. (NotNull)
|
|
|
|
+ * @exception EntityAlreadyUpdatedException When the entity has already been updated.
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void varyingUpdate(final KeyMatch keyMatch,
|
|
|
|
+ final UpdateOption<KeyMatchCB> option) {
|
|
|
|
+ assertUpdateOptionNotNull(option);
|
|
|
|
+ doUpdate(keyMatch, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Update the entity with varying requests non-strictly modified-only. (ZeroUpdateException, NonExclusiveControl) <br />
|
|
|
|
+ * For example, self(selfCalculationSpecification), specify(updateColumnSpecification), disableCommonColumnAutoSetup(). <br />
|
|
|
|
+ * Other specifications are same as updateNonstrict(entity).
|
|
|
|
+ * <pre>
|
|
|
|
+ * <span style="color: #3F7E5E">// ex) you can update by self calculation values</span>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * keyMatch.setPK...(value); <span style="color: #3F7E5E">// required</span>
|
|
|
|
+ * keyMatch.setOther...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set a value of concurrency column</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setVersionNo(value);</span>
|
|
|
|
+ * UpdateOption<KeyMatchCB> option = new UpdateOption<KeyMatchCB>();
|
|
|
|
+ * option.self(new SpecifyQuery<KeyMatchCB>() {
|
|
|
|
+ * public void specify(KeyMatchCB cb) {
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnFooCount()</span>;
|
|
|
|
+ * }
|
|
|
|
+ * }).plus(1); <span style="color: #3F7E5E">// FOO_COUNT = FOO_COUNT + 1</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">varyingUpdateNonstrict</span>(keyMatch, option);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity of update. (NotNull, PrimaryKeyNotNull)
|
|
|
|
+ * @param option The option of update for varying requests. (NotNull)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void varyingUpdateNonstrict(final KeyMatch keyMatch,
|
|
|
|
+ final UpdateOption<KeyMatchCB> option) {
|
|
|
|
+ assertUpdateOptionNotNull(option);
|
|
|
|
+ doUpdateNonstrict(keyMatch, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Insert or update the entity with varying requests. (ExclusiveControl: when update) <br />
|
|
|
|
+ * Other specifications are same as insertOrUpdate(entity).
|
|
|
|
+ * @param keyMatch The entity of insert or update. (NotNull)
|
|
|
|
+ * @param insertOption The option of insert for varying requests. (NotNull)
|
|
|
|
+ * @param updateOption The option of update for varying requests. (NotNull)
|
|
|
|
+ * @exception EntityAlreadyUpdatedException When the entity has already been updated.
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void varyingInsertOrUpdate(final KeyMatch keyMatch,
|
|
|
|
+ final InsertOption<KeyMatchCB> insertOption,
|
|
|
|
+ final UpdateOption<KeyMatchCB> updateOption) {
|
|
|
|
+ assertInsertOptionNotNull(insertOption);
|
|
|
|
+ assertUpdateOptionNotNull(updateOption);
|
|
|
|
+ doInsertOrUpdate(keyMatch, insertOption, updateOption);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Insert or update the entity with varying requests non-strictly. (NonExclusiveControl: when update) <br />
|
|
|
|
+ * Other specifications are same as insertOrUpdateNonstrict(entity).
|
|
|
|
+ * @param keyMatch The entity of insert or update. (NotNull)
|
|
|
|
+ * @param insertOption The option of insert for varying requests. (NotNull)
|
|
|
|
+ * @param updateOption The option of update for varying requests. (NotNull)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ * @exception EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
|
|
|
|
+ */
|
|
|
|
+ public void varyingInsertOrUpdateNonstrict(final KeyMatch keyMatch,
|
|
|
|
+ final InsertOption<KeyMatchCB> insertOption,
|
|
|
|
+ final UpdateOption<KeyMatchCB> updateOption) {
|
|
|
|
+ assertInsertOptionNotNull(insertOption);
|
|
|
|
+ assertUpdateOptionNotNull(updateOption);
|
|
|
|
+ doInsertOrUpdateNonstrict(keyMatch, insertOption, updateOption);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Delete the entity with varying requests. (ZeroUpdateException, ExclusiveControl) <br />
|
|
|
|
+ * Now a valid option does not exist. <br />
|
|
|
|
+ * Other specifications are same as delete(entity).
|
|
|
|
+ * @param keyMatch The entity of delete. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnNotNull)
|
|
|
|
+ * @param option The option of update for varying requests. (NotNull)
|
|
|
|
+ * @exception EntityAlreadyUpdatedException When the entity has already been updated.
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ */
|
|
|
|
+ public void varyingDelete(final KeyMatch keyMatch,
|
|
|
|
+ final DeleteOption<KeyMatchCB> option) {
|
|
|
|
+ assertDeleteOptionNotNull(option);
|
|
|
|
+ doDelete(keyMatch, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Delete the entity with varying requests non-strictly. (ZeroUpdateException, NonExclusiveControl) <br />
|
|
|
|
+ * Now a valid option does not exist. <br />
|
|
|
|
+ * Other specifications are same as deleteNonstrict(entity).
|
|
|
|
+ * @param keyMatch The entity of delete. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnNotNull)
|
|
|
|
+ * @param option The option of update for varying requests. (NotNull)
|
|
|
|
+ * @exception EntityAlreadyDeletedException When the entity has already been deleted. (not found)
|
|
|
|
+ * @exception EntityDuplicatedException When the entity has been duplicated.
|
|
|
|
+ */
|
|
|
|
+ public void varyingDeleteNonstrict(final KeyMatch keyMatch,
|
|
|
|
+ final DeleteOption<KeyMatchCB> option) {
|
|
|
|
+ assertDeleteOptionNotNull(option);
|
|
|
|
+ doDeleteNonstrict(keyMatch, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // -----------------------------------------------------
|
|
|
|
+ // Batch Update
|
|
|
|
+ // ------------
|
|
|
|
+ /**
|
|
|
|
+ * Batch-insert the list with varying requests. <br />
|
|
|
|
+ * For example, disableCommonColumnAutoSetup()
|
|
|
|
+ * , disablePrimaryKeyIdentity(), limitBatchInsertLogging(). <br />
|
|
|
|
+ * Other specifications are same as batchInsert(entityList).
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @param option The option of insert for varying requests. (NotNull)
|
|
|
|
+ * @return The array of updated count. (NotNull, EmptyAllowed)
|
|
|
|
+ */
|
|
|
|
+ public int[] varyingBatchInsert(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final InsertOption<KeyMatchCB> option) {
|
|
|
|
+ assertInsertOptionNotNull(option);
|
|
|
|
+ return doBatchInsert(keyMatchList, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-update the list with varying requests. <br />
|
|
|
|
+ * For example, self(selfCalculationSpecification), specify(updateColumnSpecification)
|
|
|
|
+ * , disableCommonColumnAutoSetup(), limitBatchUpdateLogging(). <br />
|
|
|
|
+ * Other specifications are same as batchUpdate(entityList).
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @param option The option of update for varying requests. (NotNull)
|
|
|
|
+ * @return The array of updated count. (NotNull, EmptyAllowed)
|
|
|
|
+ */
|
|
|
|
+ public int[] varyingBatchUpdate(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final UpdateOption<KeyMatchCB> option) {
|
|
|
|
+ assertUpdateOptionNotNull(option);
|
|
|
|
+ return doBatchUpdate(keyMatchList, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-update the list with varying requests non-strictly. <br />
|
|
|
|
+ * For example, self(selfCalculationSpecification), specify(updateColumnSpecification)
|
|
|
|
+ * , disableCommonColumnAutoSetup(), limitBatchUpdateLogging(). <br />
|
|
|
|
+ * Other specifications are same as batchUpdateNonstrict(entityList).
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @param option The option of update for varying requests. (NotNull)
|
|
|
|
+ * @return The array of updated count. (NotNull, EmptyAllowed)
|
|
|
|
+ */
|
|
|
|
+ public int[] varyingBatchUpdateNonstrict(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final UpdateOption<KeyMatchCB> option) {
|
|
|
|
+ assertUpdateOptionNotNull(option);
|
|
|
|
+ return doBatchUpdateNonstrict(keyMatchList, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-delete the list with varying requests. <br />
|
|
|
|
+ * For example, limitBatchDeleteLogging(). <br />
|
|
|
|
+ * Other specifications are same as batchDelete(entityList).
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @param option The option of delete for varying requests. (NotNull)
|
|
|
|
+ * @return The array of deleted count. (NotNull, EmptyAllowed)
|
|
|
|
+ */
|
|
|
|
+ public int[] varyingBatchDelete(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final DeleteOption<KeyMatchCB> option) {
|
|
|
|
+ assertDeleteOptionNotNull(option);
|
|
|
|
+ return doBatchDelete(keyMatchList, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Batch-delete the list with varying requests non-strictly. <br />
|
|
|
|
+ * For example, limitBatchDeleteLogging(). <br />
|
|
|
|
+ * Other specifications are same as batchDeleteNonstrict(entityList).
|
|
|
|
+ * @param keyMatchList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
|
|
|
|
+ * @param option The option of delete for varying requests. (NotNull)
|
|
|
|
+ * @return The array of deleted count. (NotNull, EmptyAllowed)
|
|
|
|
+ */
|
|
|
|
+ public int[] varyingBatchDeleteNonstrict(final List<KeyMatch> keyMatchList,
|
|
|
|
+ final DeleteOption<KeyMatchCB> option) {
|
|
|
|
+ assertDeleteOptionNotNull(option);
|
|
|
|
+ return doBatchDeleteNonstrict(keyMatchList, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // -----------------------------------------------------
|
|
|
|
+ // Query Update
|
|
|
|
+ // ------------
|
|
|
|
+ /**
|
|
|
|
+ * Insert the several entities by query with varying requests (modified-only for fixed value). <br />
|
|
|
|
+ * For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity(). <br />
|
|
|
|
+ * Other specifications are same as queryInsert(entity, setupper).
|
|
|
|
+ * @param setupper The setup-per of query-insert. (NotNull)
|
|
|
|
+ * @param option The option of insert for varying requests. (NotNull)
|
|
|
|
+ * @return The inserted count.
|
|
|
|
+ */
|
|
|
|
+ public int varyingQueryInsert(
|
|
|
|
+ final QueryInsertSetupper<KeyMatch, KeyMatchCB> setupper,
|
|
|
|
+ final InsertOption<KeyMatchCB> option) {
|
|
|
|
+ assertInsertOptionNotNull(option);
|
|
|
|
+ return doQueryInsert(setupper, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Update the several entities by query with varying requests non-strictly modified-only. {NonExclusiveControl} <br />
|
|
|
|
+ * For example, self(selfCalculationSpecification), specify(updateColumnSpecification)
|
|
|
|
+ * , disableCommonColumnAutoSetup(), allowNonQueryUpdate(). <br />
|
|
|
|
+ * Other specifications are same as queryUpdate(entity, cb).
|
|
|
|
+ * <pre>
|
|
|
|
+ * <span style="color: #3F7E5E">// ex) you can update by self calculation values</span>
|
|
|
|
+ * KeyMatch keyMatch = new KeyMatch();
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set PK value</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setPK...(value);</span>
|
|
|
|
+ * keyMatch.setOther...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// you don't need to set a value of concurrency column</span>
|
|
|
|
+ * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
|
|
|
|
+ * <span style="color: #3F7E5E">//keyMatch.setVersionNo(value);</span>
|
|
|
|
+ * KeyMatchCB cb = new KeyMatchCB();
|
|
|
|
+ * cb.query().setFoo...(value);
|
|
|
|
+ * UpdateOption<KeyMatchCB> option = new UpdateOption<KeyMatchCB>();
|
|
|
|
+ * option.self(new SpecifyQuery<KeyMatchCB>() {
|
|
|
|
+ * public void specify(KeyMatchCB cb) {
|
|
|
|
+ * cb.specify().<span style="color: #DD4747">columnFooCount()</span>;
|
|
|
|
+ * }
|
|
|
|
+ * }).plus(1); <span style="color: #3F7E5E">// FOO_COUNT = FOO_COUNT + 1</span>
|
|
|
|
+ * keyMatchBhv.<span style="color: #DD4747">varyingQueryUpdate</span>(keyMatch, cb, option);
|
|
|
|
+ * </pre>
|
|
|
|
+ * @param keyMatch The entity that contains update values. (NotNull) {PrimaryKeyNotRequired}
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @param option The option of update for varying requests. (NotNull)
|
|
|
|
+ * @return The updated count.
|
|
|
|
+ * @exception NonQueryUpdateNotAllowedException When the query has no condition (if not allowed).
|
|
|
|
+ */
|
|
|
|
+ public int varyingQueryUpdate(final KeyMatch keyMatch, final KeyMatchCB cb,
|
|
|
|
+ final UpdateOption<KeyMatchCB> option) {
|
|
|
|
+ assertUpdateOptionNotNull(option);
|
|
|
|
+ return doQueryUpdate(keyMatch, cb, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Delete the several entities by query with varying requests non-strictly. <br />
|
|
|
|
+ * For example, allowNonQueryDelete(). <br />
|
|
|
|
+ * Other specifications are same as batchUpdateNonstrict(entityList).
|
|
|
|
+ * @param cb The condition-bean of KeyMatch. (NotNull)
|
|
|
|
+ * @param option The option of delete for varying requests. (NotNull)
|
|
|
|
+ * @return The deleted count.
|
|
|
|
+ * @exception NonQueryDeleteNotAllowedException When the query has no condition (if not allowed).
|
|
|
|
+ */
|
|
|
|
+ public int varyingQueryDelete(final KeyMatchCB cb,
|
|
|
|
+ final DeleteOption<KeyMatchCB> option) {
|
|
|
|
+ assertDeleteOptionNotNull(option);
|
|
|
|
+ return doQueryDelete(cb, option);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // OutsideSql
|
|
|
|
+ // ==========
|
|
|
|
+ /**
|
|
|
|
+ * Prepare the basic executor of outside-SQL to execute it. <br />
|
|
|
|
+ * The invoker of behavior command should be not null when you call this method.
|
|
|
|
+ * <pre>
|
|
|
|
+ * You can use the methods for outside-SQL are as follows:
|
|
|
|
+ * {Basic}
|
|
|
|
+ * o selectList()
|
|
|
|
+ * o execute()
|
|
|
|
+ * o call()
|
|
|
|
+ *
|
|
|
|
+ * {Entity}
|
|
|
|
+ * o entityHandling().selectEntity()
|
|
|
|
+ * o entityHandling().selectEntityWithDeletedCheck()
|
|
|
|
+ *
|
|
|
|
+ * {Paging}
|
|
|
|
+ * o autoPaging().selectList()
|
|
|
|
+ * o autoPaging().selectPage()
|
|
|
|
+ * o manualPaging().selectList()
|
|
|
|
+ * o manualPaging().selectPage()
|
|
|
|
+ *
|
|
|
|
+ * {Cursor}
|
|
|
|
+ * o cursorHandling().selectCursor()
|
|
|
|
+ *
|
|
|
|
+ * {Option}
|
|
|
|
+ * o dynamicBinding().selectList()
|
|
|
|
+ * o removeBlockComment().selectList()
|
|
|
|
+ * o removeLineComment().selectList()
|
|
|
|
+ * o formatSql().selectList()
|
|
|
|
+ * </pre>
|
|
|
|
+ * @return The basic executor of outside-SQL. (NotNull)
|
|
|
|
+ */
|
|
|
|
+ public OutsideSqlBasicExecutor<KeyMatchBhv> outsideSql() {
|
|
|
|
+ return doOutsideSql();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Optimistic Lock Info
|
|
|
|
+ // ====================
|
|
|
|
+ @Override
|
|
|
|
+ protected boolean hasVersionNoValue(final Entity et) {
|
|
|
|
+ return downcast(et).getVersionNo() != null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // ===================================================================================
|
|
|
|
+ // Assist Helper
|
|
|
|
+ // =============
|
|
|
|
+ protected Class<KeyMatch> typeOfSelectedEntity() {
|
|
|
|
+ return KeyMatch.class;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatch downcast(final Entity et) {
|
|
|
|
+ return helpEntityDowncastInternally(et, KeyMatch.class);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected KeyMatchCB downcast(final ConditionBean cb) {
|
|
|
|
+ return helpConditionBeanDowncastInternally(cb, KeyMatchCB.class);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
+ protected List<KeyMatch> downcast(final List<? extends Entity> ls) {
|
|
|
|
+ return (List<KeyMatch>) ls;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
+ protected InsertOption<KeyMatchCB> downcast(
|
|
|
|
+ final InsertOption<? extends ConditionBean> op) {
|
|
|
|
+ return (InsertOption<KeyMatchCB>) op;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
+ protected UpdateOption<KeyMatchCB> downcast(
|
|
|
|
+ final UpdateOption<? extends ConditionBean> op) {
|
|
|
|
+ return (UpdateOption<KeyMatchCB>) op;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
+ protected DeleteOption<KeyMatchCB> downcast(
|
|
|
|
+ final DeleteOption<? extends ConditionBean> op) {
|
|
|
|
+ return (DeleteOption<KeyMatchCB>) op;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
+ protected QueryInsertSetupper<KeyMatch, KeyMatchCB> downcast(
|
|
|
|
+ final QueryInsertSetupper<? extends Entity, ? extends ConditionBean> sp) {
|
|
|
|
+ return (QueryInsertSetupper<KeyMatch, KeyMatchCB>) sp;
|
|
|
|
+ }
|
|
|
|
+}
|