© 2002 BEA Systems, Inc.


com.bea.p13n.property
Class SqlBundle

java.lang.Object
  |
  +--com.bea.p13n.property.SqlBundle

public class SqlBundle
extends java.lang.Object

Utility class to externalize SQL statements in a ResourceBundle.


Field Summary
static java.lang.String SQL_BUNDLE
          the property to read to find the name of our sql bundle
 
Constructor Summary
SqlBundle()
          Default constructor
SqlBundle(java.lang.String defaultBundleName)
          Construct a SqlBundle with a default bundle name
 
Method Summary
 java.sql.PreparedStatement getStatement(java.sql.Connection conn, java.lang.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(java.lang.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 java.lang.String SQL_BUNDLE
the property to read to find the name of our sql bundle
Constructor Detail

SqlBundle

public SqlBundle()
Default constructor

SqlBundle

public SqlBundle(java.lang.String defaultBundleName)
Construct a SqlBundle with a default bundle name
Method Detail

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(java.lang.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

getStatement

public java.sql.PreparedStatement getStatement(java.sql.Connection conn,
                                               java.lang.String key)
                                        throws java.sql.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:
java.sql.SQLException - if an error occurs creating the statement

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved