1 2 24 25 package com.lutris.appserver.server.sessionEnhydra.persistent; 26 27 import java.sql.PreparedStatement ; 28 import java.sql.ResultSet ; 29 import java.sql.SQLException ; 30 31 import com.lutris.appserver.server.sql.DBConnection; 32 import com.lutris.appserver.server.sql.Query; 33 34 40 class SessionQuery implements Query { 41 42 private String sessionKey; 43 private ClassLoader loader; 44 45 52 SessionQuery(String sessionKey, ClassLoader loader) { 53 this.sessionKey = sessionKey; 54 this.loader = loader; 55 } 56 57 63 public ResultSet executeQuery(DBConnection conn) 64 throws SQLException { 65 String sql = "select * from " + PersistentSessionHome.dbTableName 66 + " where sessionKey = ?"; 67 PreparedStatement stmt = conn.prepareStatement(sql); 68 stmt.setString(1, sessionKey); 69 return conn.executeQuery(stmt, sql); 70 } 71 72 79 public Object next(ResultSet rs) throws SQLException { 80 try { 81 if (rs.next()) { 82 return new PersistentSessionDO(rs, loader).getSession(); 83 } 84 } catch (SQLException e) { 85 throw e; 86 } catch (Exception e) { 87 throw new SQLException (e.getMessage()); 88 } 89 return null; 90 } 91 92 } 93 | Popular Tags |