FileDocCategorySizeDatePackage
InsertObjectQuery.javaAPI DocGlassfish v2 API4068Tue May 22 16:54:50 BST 2007oracle.toplink.essentials.queryframework

InsertObjectQuery

public class InsertObjectQuery extends WriteObjectQuery

Purpose: Used for inserting new objects into the database.

Description: This class does not have much behavior. It inherits most of it's behavior from WriteObjectQuery

author
Yvon Lavoie
since
TOPLink/Java 1.0

Fields Summary
Constructors Summary
public InsertObjectQuery()
PUBLIC: Default constructor.

        super();
    
public InsertObjectQuery(Object objectToInsert)
PUBLIC: Create an insert query with the object being inserted.

        this();
        setObject(objectToInsert);
    
public InsertObjectQuery(Call call)
PUBLIC: Create an insert query with the custom call.

        this();
        setCall(call);
    
Methods Summary
public voidexecuteCommit()
INTERNAL: Perform an insert.

        // object will only be null if the transaction is being commited directly from a changeset
        if (getObject() != null) {
            // if the object is not null then it is more effecient to build the row from the
            // object then the changeSet.
            getQueryMechanism().insertObjectForWrite();
        } else {
            // has a changeSet so we must use it in the case that there is no object
            getQueryMechanism().insertObjectForWriteWithChangeSet();
        }
    
public voidexecuteShallowWrite()
INTERNAL: Perform a shallow insert.

        getQueryMechanism().shallowInsertObjectForWrite(getObject(), this, getSession().getCommitManager());
    
public booleanisInsertObjectQuery()
PUBLIC: Return if this is an insert object query.

        return true;
    
protected voidprepare()
INTERNAL: Prepare the receiver for execution in a session.

        super.prepare();

        getQueryMechanism().prepareInsertObject();