wood burning stoves 2.0*
The moose likes Struts and the fly likes want to delete the record Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "want to delete the record" Watch "want to delete the record" New topic
Author

want to delete the record

Pradeep
Ranch Hand

Joined: Sep 19, 2006
Posts: 49
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;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: want to delete the record