diff --git a/src/java/org/thdl/lex/LexRepository.java b/src/java/org/thdl/lex/LexRepository.java index 39a922f..499f471 100644 --- a/src/java/org/thdl/lex/LexRepository.java +++ b/src/java/org/thdl/lex/LexRepository.java @@ -85,6 +85,12 @@ public class LexRepository */ private Connection getConnection() { + if ( null == connection || connection.isClosed() ) + { + Context context = new InitialContext(); + DataSource source = (DataSource) context.lookup( LexConstants.DATASOURCE_NAME ); + setConnection( source.getConnection() ); + } return connection; } @@ -97,6 +103,12 @@ public class LexRepository */ public Statement getQueryStatement() { + if ( getConnection().isClosed() ) + { + Context context = new InitialContext(); + DataSource source = (DataSource) context.lookup( LexConstants.DATASOURCE_NAME ); + setConnection( source.getConnection() ); + } return queryStatement; }