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

org.hibernate.hql.ast.tree.InsertStatement Maven / Gradle / Ivy

There is a newer version: 3.6.0.Beta2
Show newest version
// $Id: InsertStatement.java 7460 2005-07-12 20:27:29Z steveebersole $
package org.hibernate.hql.ast.tree;

import org.hibernate.QueryException;
import org.hibernate.hql.antlr.HqlSqlTokenTypes;

/**
 * Defines a top-level AST node representing an HQL "insert select" statement.
 *
 * @author Steve Ebersole
 */
public class InsertStatement extends AbstractStatement {

	/**
	 * @see Statement#getStatementType()
	 */
	public int getStatementType() {
		return HqlSqlTokenTypes.INSERT;
	}

	/**
	 * @see Statement#needsExecutor()
	 */
	public boolean needsExecutor() {
		return true;
	}

	/**
	 * Performs detailed semantic validation on this insert statement tree.
	 *
	 * @throws QueryException Indicates validation failure.
	 */
	public void validate() throws QueryException {
		getIntoClause().validateTypes( getSelectClause() );
	}

	/**
	 * Retreive this insert statement's into-clause.
	 *
	 * @return The into-clause
	 */
	public IntoClause getIntoClause() {
		return ( IntoClause ) getFirstChild();
	}

	/**
	 * Retreive this insert statement's select-clause.
	 *
	 * @return The select-clause.
	 */
	public SelectClause getSelectClause() {
		return ( ( QueryNode ) getIntoClause().getNextSibling() ).getSelectClause();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy