© 2005 BEA Systems, Inc.

com.bea.p13n.property
Class SqlBundle

java.lang.Object
  extended bycom.bea.p13n.property.SqlBundle

public class SqlBundle
extends Object

Utility class to externalize SQL statements in a ResourceBundle.


Field Summary
static String SQL_BUNDLE
          the property to read to find the name of our sql bundle
 
Constructor Summary
SqlBundle()
          Default constructor
SqlBundle(String defaultBundleName)
          Construct a SqlBundle with a default bundle name
 
Method Summary
 PreparedStatement getStatement(Connection conn, String key)
          Use the provided connection to prepare the SQL statement named by the provided key.
 void init()
          Initialize the ResourceBundle that backs up this bundle.
 void init(String defaultSqlBundle)
          Initialize the ResourceBundle that backs up this bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_BUNDLE

public static final String SQL_BUNDLE
the property to read to find the name of our sql bundle

See Also:
Constant Field Values
Constructor Detail

SqlBundle

public SqlBundle()
Default constructor


SqlBundle

public SqlBundle(String defaultBundleName)
Construct a SqlBundle with a default bundle name

Method Detail

getStatement

public PreparedStatement getStatement(Connection conn,
                                      String key)
                               throws SQLException
Use the provided connection to prepare the SQL statement named by the provided key.

Parameters:
conn - a valid database connection
key - the key to lookup a SQL statement with
Returns:
a PreparedStatement created with the sql
Throws:
SQLException - if an error occurs creating the statement

init

public void init()
Initialize the ResourceBundle that backs up this bundle. This will look for the variable "SqlBundle" in the initial context to find the name to use for the ResourceBundle; if that is not found it will fall back to the name provided in the constructor.


init

public void init(String defaultSqlBundle)
Initialize the ResourceBundle that backs up this bundle. This will look for the variable "SqlBundle" in the initial context to find the name to use for the ResourceBundle; if that is not found it will fall back to the provided name.

Parameters:
defaultSqlBundle - the default name to use for the ResourceBundle

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved