com.mysema.query.sql.dml
Class SQLInsertClause

java.lang.Object
  extended by com.mysema.query.sql.dml.AbstractSQLClause<SQLInsertClause>
      extended by com.mysema.query.sql.dml.SQLInsertClause
All Implemented Interfaces:
com.mysema.query.dml.DMLClause<SQLInsertClause>, com.mysema.query.dml.InsertClause<SQLInsertClause>, com.mysema.query.dml.StoreClause<SQLInsertClause>
Direct Known Subclasses:
MySQLReplaceClause

public class SQLInsertClause
extends AbstractSQLClause<SQLInsertClause>
implements com.mysema.query.dml.InsertClause<SQLInsertClause>

SQLInsertClause defines an INSERT INTO clause

Author:
tiwe

Field Summary
 
Fields inherited from class com.mysema.query.sql.dml.AbstractSQLClause
configuration
 
Constructor Summary
SQLInsertClause(Connection connection, Configuration configuration, RelationalPath<?> entity)
           
SQLInsertClause(Connection connection, Configuration configuration, RelationalPath<?> entity, AbstractSQLSubQuery<?> subQuery)
           
SQLInsertClause(Connection connection, SQLTemplates templates, RelationalPath<?> entity)
           
SQLInsertClause(Connection connection, SQLTemplates templates, RelationalPath<?> entity, AbstractSQLSubQuery<?> subQuery)
           
 
Method Summary
 SQLInsertClause addBatch()
          Add the current state of bindings as a batch item
 SQLInsertClause addFlag(com.mysema.query.QueryFlag.Position position, com.mysema.query.types.Expression<?> flag)
          Add the given Expression at the given position as a query flag
 SQLInsertClause addFlag(com.mysema.query.QueryFlag.Position position, String flag)
          Add the given String literal at the given position as a query flag
 SQLInsertClause columns(com.mysema.query.types.Path<?>... columns)
           
 long execute()
           
<T> T
executeWithKey(Class<T> type)
           
<T> T
executeWithKey(com.mysema.query.types.Path<T> path)
          Execute the clause and return the generated key with the type of the given path.
 ResultSet executeWithKeys()
          Execute the clause and return the generated keys as a ResultSet
<T> List<T>
executeWithKeys(Class<T> type)
           
<T> List<T>
executeWithKeys(com.mysema.query.types.Path<T> path)
          Execute the clause and return the generated keys with the type of the given path.
 SQLInsertClause populate(Object bean)
          Populate the INSERT clause with the properties of the given bean.
<T> SQLInsertClause
populate(T obj, Mapper<T> mapper)
          Populate the INSERT clause with the properties of the given bean using the given Mapper.
 SQLInsertClause select(com.mysema.query.types.SubQueryExpression<?> sq)
           
<T> SQLInsertClause
set(com.mysema.query.types.Path<T> path, com.mysema.query.types.Expression<? extends T> expression)
           
<T> SQLInsertClause
set(com.mysema.query.types.Path<T> path, T value)
           
<T> SQLInsertClause
setNull(com.mysema.query.types.Path<T> path)
           
 String toString()
           
 SQLInsertClause values(Object... v)
           
 
Methods inherited from class com.mysema.query.sql.dml.AbstractSQLClause
close, close, executeBatch, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SQLInsertClause

public SQLInsertClause(Connection connection,
                       SQLTemplates templates,
                       RelationalPath<?> entity)

SQLInsertClause

public SQLInsertClause(Connection connection,
                       SQLTemplates templates,
                       RelationalPath<?> entity,
                       AbstractSQLSubQuery<?> subQuery)

SQLInsertClause

public SQLInsertClause(Connection connection,
                       Configuration configuration,
                       RelationalPath<?> entity,
                       AbstractSQLSubQuery<?> subQuery)

SQLInsertClause

public SQLInsertClause(Connection connection,
                       Configuration configuration,
                       RelationalPath<?> entity)
Method Detail

addFlag

public SQLInsertClause addFlag(com.mysema.query.QueryFlag.Position position,
                               String flag)
Add the given String literal at the given position as a query flag

Parameters:
position -
flag -
Returns:

addFlag

public SQLInsertClause addFlag(com.mysema.query.QueryFlag.Position position,
                               com.mysema.query.types.Expression<?> flag)
Add the given Expression at the given position as a query flag

Parameters:
position -
flag -
Returns:

addBatch

public SQLInsertClause addBatch()
Add the current state of bindings as a batch item

Returns:

columns

public SQLInsertClause columns(com.mysema.query.types.Path<?>... columns)
Specified by:
columns in interface com.mysema.query.dml.InsertClause<SQLInsertClause>

executeWithKey

@Nullable
public <T> T executeWithKey(com.mysema.query.types.Path<T> path)
Execute the clause and return the generated key with the type of the given path. If no rows were created, null is returned, otherwise the key of the first row is returned.

Type Parameters:
T -
Parameters:
path -
Returns:

executeWithKey

public <T> T executeWithKey(Class<T> type)

executeWithKeys

public <T> List<T> executeWithKeys(com.mysema.query.types.Path<T> path)
Execute the clause and return the generated keys with the type of the given path. If now rows were created and empty list is returned.

Type Parameters:
T -
Parameters:
path -
Returns:

executeWithKeys

public <T> List<T> executeWithKeys(Class<T> type)

executeWithKeys

public ResultSet executeWithKeys()
Execute the clause and return the generated keys as a ResultSet

Returns:

execute

public long execute()
Specified by:
execute in interface com.mysema.query.dml.DMLClause<SQLInsertClause>

select

public SQLInsertClause select(com.mysema.query.types.SubQueryExpression<?> sq)
Specified by:
select in interface com.mysema.query.dml.InsertClause<SQLInsertClause>

set

public <T> SQLInsertClause set(com.mysema.query.types.Path<T> path,
                               T value)
Specified by:
set in interface com.mysema.query.dml.StoreClause<SQLInsertClause>

set

public <T> SQLInsertClause set(com.mysema.query.types.Path<T> path,
                               com.mysema.query.types.Expression<? extends T> expression)
Specified by:
set in interface com.mysema.query.dml.StoreClause<SQLInsertClause>

setNull

public <T> SQLInsertClause setNull(com.mysema.query.types.Path<T> path)
Specified by:
setNull in interface com.mysema.query.dml.StoreClause<SQLInsertClause>

values

public SQLInsertClause values(Object... v)
Specified by:
values in interface com.mysema.query.dml.InsertClause<SQLInsertClause>

toString

public String toString()
Overrides:
toString in class Object

populate

public SQLInsertClause populate(Object bean)
Populate the INSERT clause with the properties of the given bean. The properties need to match the fields of the clause's entity instance.

Parameters:
bean -
Returns:

populate

public <T> SQLInsertClause populate(T obj,
                                    Mapper<T> mapper)
Populate the INSERT clause with the properties of the given bean using the given Mapper.

Parameters:
obj -
mapper -
Returns:


Copyright © 2007-2012 Mysema Ltd. All Rights Reserved.