Initial
This commit is contained in:
53
proto/HistoricRS.java
Normal file
53
proto/HistoricRS.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package zbi.risk.server.vhi.mapped
|
||||
|
||||
public class HistoricDA
|
||||
{
|
||||
public List readAll()throws SQLException
|
||||
{
|
||||
Statement statement=null;
|
||||
ResultSet rs=null;
|
||||
Connection connection=null;
|
||||
String strQuery=null;
|
||||
List list=null;
|
||||
|
||||
try
|
||||
{
|
||||
<classname> <instancename> = new <classname>
|
||||
connection=getConnection();
|
||||
statement=connection.createStatement();
|
||||
list=new ArrayList();
|
||||
strQuery="select jdjdjd djdjdjd djdjdjd from <tablename>";
|
||||
rs=statement.executeQuery(strQuery);
|
||||
while(rs.next())
|
||||
{
|
||||
<assign variables>
|
||||
list.add(<instancename>);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(null!=rs)rs.close();
|
||||
if(null!=statement)statement.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private Connection getConnection()throws SQLException
|
||||
{
|
||||
try
|
||||
{
|
||||
InitialContext jndiCntx=new InitialContext();
|
||||
DataSource ds=(DataSource)jndiCntx.lookup("java:MailDb");
|
||||
jndiCntx.close();
|
||||
return ds.getConnection();
|
||||
}
|
||||
catch(NamingException exception)
|
||||
{
|
||||
message("[MailEJB::getConnection] Object not found");
|
||||
throw new EJBException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user