LoginSignup
1
1

More than 5 years have passed since last update.

SAStruts + S2JDBC + SQLServerで指定テーブルのIDENTITYを取得する

Last updated at Posted at 2015-01-31

public abstract class BaseService<T> extends S2AbstractService<T> {
/**
* 与えられたテーブルのIDENTITYを取得する。
*
* @return
*/
public Integer getLastId(String tableName) {
Integer lastId=
jdbcManager
.selectBySql(
Integer.class,
"SELECT IDENT_CURRENT('"+tableName+"');")
.getSingleResult();
return lastId;
}
}

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1