|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.cinecolombia.common.utilcomponents.DAOUtil
This utility class for EJB tier components.
Constructor Summary | |
DAOUtil()
|
Method Summary | |
static void |
closeCallableStatement(java.sql.CallableStatement cstmt)
Close a CallableStatement |
static void |
closeConnection(java.sql.Connection dbConnection)
Close database connection associated to dbConnection attribute |
static void |
closePreparedStatement(java.sql.PreparedStatement stmt)
Close a PreparedStatement statement |
static void |
closeResultSet(java.sql.ResultSet result)
Close a resultSet |
static void |
closeStatement(java.sql.Statement stmt)
Close a statement |
static byte[] |
getBlobImage(java.sql.Blob blobRef,
byte[] imageArray)
Get BLOB image from DB |
static java.sql.Blob |
getBlobReference(java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Obtain reference to BLOB field in the DB |
static java.lang.String |
getBlobText(java.sql.Blob blobRef,
byte[] textArray)
Get BLOB text from DB |
static javax.sql.DataSource |
getDataSource(java.lang.String dsName)
Get the DataSource associated to a JNDIName |
static java.sql.Connection |
getDBConnection(javax.sql.DataSource datasource)
Get a database connection |
static int |
getNullInt(java.sql.ResultSet rs,
int index)
metodo auxiliar que obtiene un valor int de un Resultset, posiblemente null, |
static long |
getNullLong(java.sql.ResultSet rs,
int index)
metodo auxiliar que obtiene un valor long de un Resultset, posiblemente null, |
static int |
inputStreamTobyte(java.io.InputStream is,
byte[] array,
byte[] buf)
Get byte[] from InputStream |
static CodeDescription[] |
loadCodeDescription(java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Auxiliary for load a CodeDescription[] from DB |
static void |
rollback(java.sql.Connection dbConnection)
Rollback current transaction |
static void |
setNullDate(java.sql.PreparedStatement ps,
java.sql.Date value,
int index)
metodo auxiliar que asigna un valor, posiblemente null, a un parametro Date de un PreparedStatement |
static void |
setNullInt(java.sql.PreparedStatement ps,
int value,
int index)
metodo auxiliar que asigna un valor, posiblemente null, a un parametro int de un PreparedStatement |
static void |
setNullLong(java.sql.PreparedStatement ps,
long value,
int index)
metodo auxiliar que asigna un valor, posiblemente null, a un parametro long de un PreparedStatement |
static void |
setNullString(java.sql.PreparedStatement ps,
java.lang.String value,
int index)
metodo auxiliar que asigna un valor, posiblemente null, a un parametro String de un PreparedStatement |
static void |
showByteArray(byte[] array)
Debug: Shows first and last bytes of a byte[] |
static void |
writeBlobData(java.sql.Blob blobRef,
java.io.InputStream is)
Write BLOB data on the DB |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DAOUtil()
Method Detail |
public static javax.sql.DataSource getDataSource(java.lang.String dsName) throws DAOException
dsName
- Description of the Parameter
DAOException
public static java.sql.Connection getDBConnection(javax.sql.DataSource datasource) throws DAOException
datasource
- Description of the Parameter
DAOException
public static void closeConnection(java.sql.Connection dbConnection) throws DAOException
dbConnection
- Description of the Parameter
DAOException
public static void closeResultSet(java.sql.ResultSet result) throws DAOException
result
- is the ResultSet to close
DAOException
public static void closeStatement(java.sql.Statement stmt) throws DAOException
stmt
- is the Statement to close
DAOException
public static void closePreparedStatement(java.sql.PreparedStatement stmt) throws DAOException
stmt
- is the PreparedStatement to close
DAOException
public static void closeCallableStatement(java.sql.CallableStatement cstmt) throws DAOException
cstmt
- is the PreparedStatement to close
DAOException
public static void rollback(java.sql.Connection dbConnection) throws DAOException
dbConnection
- is the connection with the DB
DAOException
public static CodeDescription[] loadCodeDescription(java.sql.PreparedStatement ps, java.sql.ResultSet rs) throws java.lang.Exception
ps
- auxiliary PreparedStatementrs
- auxiliary ResultSet
java.lang.Exception
public static java.sql.Blob getBlobReference(java.sql.PreparedStatement ps, java.sql.ResultSet rs) throws java.lang.Exception
ps
- auxiliary PreparedStatementrs
- auxiliary ResultSet
java.lang.Exception
public static void writeBlobData(java.sql.Blob blobRef, java.io.InputStream is) throws java.lang.Exception
blobRef
- reference to a Blob fieldis
- data (InputStream) to write in the Blob field
java.lang.Exception
public static java.lang.String getBlobText(java.sql.Blob blobRef, byte[] textArray) throws java.lang.Exception
blobRef
- reference to a Blob text fieldtextArray
- is an auxiliary byte[] to receive the text
from the Blob field
java.lang.Exception
public static byte[] getBlobImage(java.sql.Blob blobRef, byte[] imageArray) throws java.lang.Exception
blobRef
- reference to a Blob text fieldimageArray
- is an auxiliary byte[] to receive the image from
the Blob field
java.lang.Exception
public static int inputStreamTobyte(java.io.InputStream is, byte[] array, byte[] buf)
is
- InputStreamarray
- byte[] for storing all the bytes of isbuf
- auxiliary byte[] for reading from is
public static void showByteArray(byte[] array)
array
- array of bytespublic static int getNullInt(java.sql.ResultSet rs, int index) throws java.lang.Exception
rs
- el Resultsetindex
- indice del parametro a obtener.
java.lang.Exception
public static long getNullLong(java.sql.ResultSet rs, int index) throws java.lang.Exception
rs
- el Resultsetindex
- indice del parametro a obtener.
java.lang.Exception
public static void setNullDate(java.sql.PreparedStatement ps, java.sql.Date value, int index) throws java.lang.Exception
ps
- el PreparedStatementvalue
- el Date posiblemente nullindex
- indice del parametro a asignar.
java.lang.Exception
public static void setNullLong(java.sql.PreparedStatement ps, long value, int index) throws java.lang.Exception
ps
- el PreparedStatementvalue
- si es UNDEF, se asignara null a ps, si no el valueindex
- indice del parametro a asignar.
java.lang.Exception
public static void setNullInt(java.sql.PreparedStatement ps, int value, int index) throws java.lang.Exception
ps
- el PreparedStatementvalue
- si es UNDEF, se asignara null a ps, si no el valueindex
- indice del parametro a asignar.
java.lang.Exception
public static void setNullString(java.sql.PreparedStatement ps, java.lang.String value, int index) throws java.lang.Exception
ps
- el PreparedStatementvalue
- el String posiblemente nullindex
- indice del parametro a asignar.
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |