Wednesday, November 27, 2013
Java Hibernate Sample ( Database calling )
Posted by
Unknown
Boolean existingFile = (Boolean) this.genericEntityDao.execute(new HibernateCallback() {
@Override
public Object doInHibernate(Session session) throws HibernateException,SQLException {
session.doWork(new Work() {
public void execute(final Connection conn) throws SQLException {
PreparedStatement pstmt;
pstmt = conn.prepareStatement(INFIORD03Constant.SQL_EXIST_FILES);
pstmt.setString(1,filename);
ResultSet rs = pstmt.executeQuery();
if(BeanUtils.isNotNull(rs)){
while (rs.next()) {
count = rs.getInt(1);
}
rs.close();
}
}
});
if(count>0) return true;
else return false;
}
});
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment