Connection con = this.createConnection( dsName );
PreparedStatement pStmt=null;
try
{
con.setAutoCommit(false);
QueryManager qManager = QueryManager.getInstance();
/* Check if there is any group with same name */
String sql;
sql = qManager.getDuplicateGroupUpdateQuery(dbType);
pStmt = con.prepareStatement( sql );
pStmt.setString( 1, groupVO.getId() );
pStmt.setString( 2, groupVO.getGroupName() );
log.debug("SQL="+sql);
log.debug("ID="+groupVO.getId()+" || "+groupVO.getGroupName());
ResultSet rset = null;
rset = pStmt.executeQuery();
if( rset.next() ){
if(rset.getInt(1)>0){
DAOException daox = new DAOException ("Database Error");
daox.setMessageKey(IErrorMessageKeys.KEY_ERROR_DUPLICATE_GROUP);
throw daox;
}
}
sql = qManager.getUpdateGroupQuery(dbType);
log.debug(sql);
pStmt = con.prepareStatement( sql );
pStmt.setString( 1, groupVO.getGroupName() );
pStmt.setString( 2, groupVO.getGroupDesc() );
pStmt.setString( 3, groupVO.getId());
pStmt.executeUpdate();
//first delete old users
sql = qManager.getDeleteGroupUserQuery(dbType);
pStmt = con.prepareStatement( sql );
pStmt.setString( 1, groupVO.getId());
pStmt.executeUpdate();
this.createSearchContent(con,dbType, groupVO, "TBL_GROUP", "GROUP_ID");
String[] userIds = EEMSUtil.convertToArray(groupVO.getUserNames(),IConstants.EEMS_DELIMITER);
if(userIds!=null)
{
sql = qManager.getFindCreateUserGroupQuery(dbType);
pStmt = con.prepareStatement( sql );
log.debug(sql);
for (int i=0; i<userIds.length;i++)
{