Search in sources :

Example 1 with SqlFieldMacro

use of org.nutz.dao.impl.entity.macro.SqlFieldMacro in project nutz by nutzam.

the class GBaseJdbcExpert method fetchPojoId.

public Pojo fetchPojoId(Entity<?> en, MappingField idField) {
    String autoSql = "SELECT @@@@IDENTITY";
    Pojo autoInfo = new SqlFieldMacro(idField, autoSql);
    autoInfo.setEntity(en);
    return autoInfo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo) SqlFieldMacro(org.nutz.dao.impl.entity.macro.SqlFieldMacro)

Example 2 with SqlFieldMacro

use of org.nutz.dao.impl.entity.macro.SqlFieldMacro in project nutz by nutzam.

the class H2JdbcExpert method fetchPojoId.

public Pojo fetchPojoId(Entity<?> en, MappingField idField) {
    String autoSql = "SELECT IDENTITY() as $field from $view";
    Pojo autoInfo = new SqlFieldMacro(idField, autoSql);
    autoInfo.setEntity(en);
    return autoInfo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo) SqlFieldMacro(org.nutz.dao.impl.entity.macro.SqlFieldMacro)

Example 3 with SqlFieldMacro

use of org.nutz.dao.impl.entity.macro.SqlFieldMacro in project nutz by nutzam.

the class DerbyJdbcExpert method fetchPojoId.

public Pojo fetchPojoId(Entity<?> en, MappingField idField) {
    String autoSql = "select IDENTITY_VAL_LOCAL() as id from " + en.getTableName();
    Pojo autoInfo = new SqlFieldMacro(idField, autoSql);
    autoInfo.setEntity(en);
    return autoInfo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo) SqlFieldMacro(org.nutz.dao.impl.entity.macro.SqlFieldMacro)

Example 4 with SqlFieldMacro

use of org.nutz.dao.impl.entity.macro.SqlFieldMacro in project nutz by nutzam.

the class SQLiteJdbcExpert method fetchPojoId.

public Pojo fetchPojoId(Entity<?> en, MappingField idField) {
    String autoSql = "SELECT MAX($field) AS $field FROM $view";
    Pojo autoInfo = new SqlFieldMacro(idField, autoSql);
    autoInfo.setEntity(en);
    return autoInfo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo) SqlFieldMacro(org.nutz.dao.impl.entity.macro.SqlFieldMacro)

Example 5 with SqlFieldMacro

use of org.nutz.dao.impl.entity.macro.SqlFieldMacro in project nutz by nutzam.

the class AbstractJdbcExpert method fetchPojoId.

public Pojo fetchPojoId(Entity<?> en, MappingField idField) {
    String autoSql = "SELECT MAX($field) AS $field FROM $view";
    Pojo autoInfo = new SqlFieldMacro(idField, autoSql);
    autoInfo.setEntity(en);
    return autoInfo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo) SqlFieldMacro(org.nutz.dao.impl.entity.macro.SqlFieldMacro)

Aggregations

SqlFieldMacro (org.nutz.dao.impl.entity.macro.SqlFieldMacro)6 Pojo (org.nutz.dao.sql.Pojo)6