Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

want to delete the record

 
Pradeep
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello

in my appln i want to delete record from database

for that i have add deleted flag in respective table

tell me how to use deleted flag in DAO class to delete

the record


my DAO class

public boolean modifyFundShare(SharesToFundDVO sharesToFundDVO,String clientName,String fundName,String mchNumber,boolean isDelete)throws KMSSystemException{
logger.info("ShareToFundDAO :: modifyFundShare :: Inside");

ResultSet rs = null;
PreparedStatement ps = null;
String shareId = null;
String shareType = null;
String currency = null;
String active = null;
Date launchDate = null;
String isinCode = null;
String comCode = null;
String wpknr = null;
String sedol = null;
String velorenTelekurs = null;
String mexid = null;
String cusip = null;
String euroclearEligible = null;
boolean update = false;
try{
conn = ServiceLocator.getInstance().getConnection();
shareId = sharesToFundDVO.getShareId();
shareType = sharesToFundDVO.getShareType();
currency = sharesToFundDVO.getCurrency();
active = sharesToFundDVO.getActive();
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
if(null != sharesToFundDVO.getLaunchDate() && !sharesToFundDVO.getLaunchDate().equals("")){
launchDate = new Date(formatter.parse(sharesToFundDVO.getLaunchDate()).getTime());
}
isinCode = sharesToFundDVO.getIsinCode();
comCode = sharesToFundDVO.getComCode();
wpknr = sharesToFundDVO.getWpknr();
sedol = sharesToFundDVO.getSedol();
velorenTelekurs = sharesToFundDVO.getVelorenTelekurs();
mexid = sharesToFundDVO.getMexid();
cusip = sharesToFundDVO.getCusip();
euroclearEligible = sharesToFundDVO.getEuroclearEligible();

if(isDelete){
ps = new LoggableStatement(conn, DELETE_SHARE);
ps.setString(1, shareId);
logger.debug("ShareToFundDAO :: modifyFundShare :: Query to delete Shares :: "+((LoggableStatement)ps).getQueryString());

}else{
ps = new LoggableStatement(conn, MODIFY_SHARE);

ps.setString(1, shareType);
ps.setString(2, currency );
ps.setString(3, active);
ps.setDate(4, launchDate);
ps.setString(5, isinCode);
ps.setString(6, comCode);
ps.setString(7, wpknr);
ps.setString(8, sedol);
ps.setString(9, velorenTelekurs);
ps.setString(10, mexid);
ps.setString(11, cusip);
ps.setString(12, euroclearEligible);
ps.setString(13, shareId);

logger.debug("ShareToFundDAO :: modifyFundShare :: Query to modify shares :: "+((LoggableStatement)ps).getQueryString());

}
update = ps.execute();
ServiceLocator.closeAll(conn,rs,ps);
} catch(SQLException sqlExec){
logger.debug("SharesToFundDAO :: modifyFundShare :: SQLException :: ",sqlExec);
throw new KMSSystemException("error.sharestofund.dao.sqlException",sqlExec);
} catch(KMSSystemException kmsExec){
logger.debug("SharesToFundDAO :: modifyFundShare :: KMSSystemException :: ",kmsExec);
throw new KMSSystemException("error.sharestofund.dao.kmsException",kmsExec);
} catch(Exception ex){
ex.printStackTrace();
}
logger.info("ShareToFundDAO :: modifyFundShare :: Exit");
return update;
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic