All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.datanucleus.store.rdbms.mapping.AppIDObjectIdFieldManager Maven / Gradle / Ivy

There is a newer version: 6.0.9
Show newest version
/**********************************************************************
Copyright (c) 2003 Erik Bengtson and others. All rights reserved. 
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.

Contributors:
2003 Andy Jefferson - coding standards
2006 Michael Brown - updated to cater for alternative types in the PK fields
	...
**********************************************************************/
package org.datanucleus.store.rdbms.mapping;

import java.sql.PreparedStatement;

import org.datanucleus.ExecutionContext;
import org.datanucleus.api.ApiAdapter;
import org.datanucleus.state.AppIdObjectIdFieldConsumer;
import org.datanucleus.store.fieldmanager.AbstractFieldManager;
import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
import org.datanucleus.store.rdbms.mapping.java.PersistableMapping;

/**
 * Parameter setter class to deal with application identity.
 * Parameters must be in the same order as the fields.
 */
public class AppIDObjectIdFieldManager extends AbstractFieldManager
{
    /** Parameter positions in the PreparedStatement. */
    private int[] params;

    /** Next parameter index. Increased each call. */
    private int nextParam;

    /** ExecutionContext. */
    private ExecutionContext ec;

    /** The PreparedStatement to populate. */
    private PreparedStatement statement;

    /** The mappings for the object id */
    private JavaTypeMapping[] javaTypeMappings;

    /** Number of the mapping being processed. */
    private int mappingNum = 0;

    /**
     * Constructor.
     * @param param Parameter positions
     * @param ec ExecutionContext
     * @param statement PreparedStatement
     * @param javaTypeMappings Java mappings for the PC object
     */
    public AppIDObjectIdFieldManager(int[] param, ExecutionContext ec, PreparedStatement statement, JavaTypeMapping[] javaTypeMappings)
    {
        this.params = param;
        nextParam = 0;
        this.ec = ec;
        this.statement = statement;

        // Save all mappings in the same order, allowing for PersistableMapping having sub mappings
        int numMappings = 0;
        for (int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy