JORM: an implementation of a generic mapping system for persistent Java
objects. Two mapping are supported: to RDBMS and to binary files. Copyright
(C) 2001-2004 France Telecom R&D - INRIA
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: jorm-team@objectweb.org
existRelation
protected boolean existRelation(Connection connection,
String relName,
String[] relationTypes)
throws SQLException
existSequence
public boolean existSequence(Connection connection,
String seqName)
throws SQLException
checks the sequence existence
- existSequence in interface SequenceAdapter
connection
- is the JDBC connection to useseqName
- is the sequence of the table
- true if the table exists, otherwise false.
existTable
public boolean existTable(Connection connection,
String tableName)
throws SQLException
- existTable in interface RdbAdapter
existView
public boolean existView(Connection connection,
String viewName)
throws SQLException
- existView in interface RdbAdapter
fetchResultSetSize
public int fetchResultSetSize(ResultSet rs)
throws SQLException
This calculates the size of a result set. If this feature is not
supported by a database or its jdbc driver, this method returns -1.
- fetchResultSetSize in interface RdbAdapter
rs
- the result set which the size must be returned
getBigDecimal
public BigDecimal getBigDecimal(ResultSet rs,
int idx,
BigDecimal nullValue)
throws SQLException
Get a BigDecimal value from a ResultSet.
- getBigDecimal in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getBigInteger
public BigInteger getBigInteger(ResultSet rs,
int idx,
BigInteger nullValue)
throws SQLException
Get a BigInteger value from a ResultSet.
- getBigInteger in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getBoolean
public boolean getBoolean(ResultSet rs,
int idx,
boolean nullValue)
throws SQLException
Get a boolean value from a ResultSet.
- getBoolean in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getByte
public byte getByte(ResultSet rs,
int idx,
byte nullValue)
throws SQLException
Get a byte value from a ResultSet.
- getByte in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getByteArray
public byte[] getByteArray(ResultSet rs,
int idx,
byte[] nullValue)
throws SQLException
Get a byte[] value from a ResultSet.
- getByteArray in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getCACHEkeyWord
protected String getCACHEkeyWord()
getChar
public char getChar(ResultSet rs,
int idx,
char nullValue)
throws SQLException
Get a char value from a ResultSet.
- getChar in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getCharArray
public static char[] getCharArray(Object o)
throws IOException,
RdbAdapterException
getCharArray
public char[] getCharArray(ResultSet rs,
int idx,
char[] nullValue)
throws SQLException
Get a char[] value from a ResultSet.
- getCharArray in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getCharArray
private static char[] getCharArray(java.io.Reader reader)
throws java.io.IOException
getCreateSequence
public String getCreateSequence(String seqName)
throws UnsupportedOperationException
- getCreateSequence in interface SequenceAdapter
seqName
- is the sequence name
- the SQL command to create a sequence
getCreateSequence
public String getCreateSequence(String seqName,
Integer startid,
Integer inc,
Integer cache)
throws UnsupportedOperationException
CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ] [
MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ] [
START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
- getCreateSequence in interface SequenceAdapter
seqName
- startid
- inc
-
getDate
public Date getDate(ResultSet rs,
int idx,
Date nullValue)
throws SQLException
Get a Date value from a ResultSet.
- getDate in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getDate
public Date getDate(ResultSet rs,
int idx,
String sqlColumnType,
Date nullValue)
throws SQLException
Get a Date value from a ResultSet.
- getDate in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getDouble
public double getDouble(ResultSet rs,
int idx,
double nullValue)
throws SQLException
Get a double value from a ResultSet.
- getDouble in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getFloat
public float getFloat(ResultSet rs,
int idx,
float nullValue)
throws SQLException
Get a float value from a ResultSet.
- getFloat in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getFromClause
protected void getFromClause(JoinedTable jt,
StringBuffer sb)
getINCREMENTkeyWord
protected String getINCREMENTkeyWord()
getInt
public int getInt(ResultSet rs,
int idx,
int nullValue)
throws SQLException
Get a int value from a ResultSet.
- getInt in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getLong
public long getLong(ResultSet rs,
int idx,
long nullValue)
throws SQLException
Get a long value from a ResultSet.
- getLong in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getNextValInSequence
public String getNextValInSequence(String seqName)
- getNextValInSequence in interface SequenceAdapter
seqName
- is the sequence name
- the SQL command to gett a new value in a SQL
sequence which the name is given in parameter.
getOboolean
public Boolean getOboolean(ResultSet rs,
int idx,
Boolean nullValue)
throws SQLException
Get a Boolean value from a ResultSet.
- getOboolean in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getObyte
public Byte getObyte(ResultSet rs,
int idx,
Byte nullValue)
throws SQLException
Get a Byte value from a ResultSet.
- getObyte in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getOchar
public Character getOchar(ResultSet rs,
int idx,
Character nullValue)
throws SQLException
Get a Character value from a ResultSet.
- getOchar in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getOdouble
public Double getOdouble(ResultSet rs,
int idx,
Double nullValue)
throws SQLException
Get a Double value from a ResultSet.
- getOdouble in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getOfloat
public Float getOfloat(ResultSet rs,
int idx,
Float nullValue)
throws SQLException
Get a Float value from a ResultSet.
- getOfloat in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getOint
public Integer getOint(ResultSet rs,
int idx,
Integer nullValue)
throws SQLException
Get a Integer value from a ResultSet.
- getOint in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getOlong
public Long getOlong(ResultSet rs,
int idx,
Long nullValue)
throws SQLException
Get a Long value from a ResultSet.
- getOlong in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getOshort
public Short getOshort(ResultSet rs,
int idx,
Short nullValue)
throws SQLException
Get a Short value from a ResultSet.
- getOshort in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getQuery
public String getQuery(String selectClause,
List jts,
String whereclause,
int rangeStart,
int rangeSize)
- getQuery in interface RdbAdapter
getSTARTkeyWord
protected String getSTARTkeyWord()
getSerialized
public Serializable getSerialized(ResultSet rs,
int idx,
Serializable nullValue)
throws SQLException,
IOException,
ClassNotFoundException
Get a Serializable value from a ResultSet.
- getSerialized in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getShort
public short getShort(ResultSet rs,
int idx,
short nullValue)
throws SQLException
Get a short value from a ResultSet.
- getShort in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getSqlType
public String getSqlType(int typeCode,
boolean usedInPK,
int size,
int scale)
throws RdbAdapterException
This method returns the SQL type linked to the java type
- getSqlType in interface TypeAdapter
typeCode
- is the type code of the java typeusedInPK
- indicates if the type has to be used into a Primary keysize
- can indicates the expected size of the type. If it equals to
NO_SIZE that means no size is expected. This parameter can be used for
float, BigXXX numbers, String,...scale
- can indicates the expected scale of the type. If it equals to
NO_SIZE that means no scale is expected.
getSqlTypeCode
public int getSqlTypeCode(int typeCode)
throws RdbAdapterException
This methods return the SQL type code linked to the java type specified
in parameter.
- getSqlTypeCode in interface TypeAdapter
- An int constant defined in the java.sql.Types class
getSqlTypeCode
public int getSqlTypeCode(int typeCode,
String sqlColumnType)
throws RdbAdapterException
This methods return the SQL type code linked to the java type specified
in parameter.
- getSqlTypeCode in interface TypeAdapter
- An int constant defined in the java.sql.Types class
getString
public String getString(ResultSet rs,
int idx,
String nullValue)
throws SQLException
Get a String value from a ResultSet.
- getString in interface ResultsetAdapter
rs
- is the result where to get the valueidx
- is the index of the value in the resultsetnullValue
- represents the nullvalue to return if the column is null
in the resultset
getValueAsSQLString
public String getValueAsSQLString(Object value,
int typeCode)
This method returns a String value that represents a value. This method
can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
value
- typeCode
- is the java type of the value
getValueAsSQLString
public String getValueAsSQLString(boolean value)
This method returns a String value that represents a boolean value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getValueAsSQLString
public String getValueAsSQLString(byte value)
This method returns a String value that represents a byte value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getValueAsSQLString
public String getValueAsSQLString(char value)
This method returns a String value that represents a char value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getValueAsSQLString
public String getValueAsSQLString(double value)
This method returns a String value that represents a double value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getValueAsSQLString
public String getValueAsSQLString(float value)
This method returns a String value that represents a float value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getValueAsSQLString
public String getValueAsSQLString(int value)
This method returns a String value that represents a int value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getValueAsSQLString
public String getValueAsSQLString(long value)
This method returns a String value that represents a long value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getValueAsSQLString
public String getValueAsSQLString(short value)
This method returns a String value that represents a short value. This
method can be used for the constant parameters of SQL queries.
- getValueAsSQLString in interface ValueAsSQLStringAdapter
getWhereClause
protected void getWhereClause(List jts,
StringBuffer sb,
String whereclause,
int rangeStart,
int rangeSize)
modifySelectClauseWithRange
protected void modifySelectClauseWithRange(StringBuffer sb,
int rangeStart,
int rangeSize)
modifyWhereClauseWithRange
protected void modifyWhereClauseWithRange(StringBuffer sb,
String where,
int rangeStart,
int rangeSize)
setBigDecimal
public void setBigDecimal(PreparedStatement ps,
int idx,
BigDecimal o)
throws SQLException
Assignes a value into a PreparedStatement
- setBigDecimal in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setBigInteger
public void setBigInteger(PreparedStatement ps,
int idx,
BigInteger o)
throws SQLException
Assignes a value into a PreparedStatement
- setBigInteger in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setBoolean
public void setBoolean(PreparedStatement ps,
int idx,
boolean o)
throws SQLException
Assignes a value into a PreparedStatement
- setBoolean in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setByte
public void setByte(PreparedStatement ps,
int idx,
byte o)
throws SQLException
Assignes a value into a PreparedStatement
- setByte in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setByteArray
public void setByteArray(PreparedStatement ps,
int idx,
byte[] o)
throws SQLException
Assignes a value into a PreparedStatement
- setByteArray in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setChar
public void setChar(PreparedStatement ps,
int idx,
char c)
throws SQLException
Assignes a value into a PreparedStatement
- setChar in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatement
setCharArray
public void setCharArray(PreparedStatement ps,
int idx,
char[] o)
throws SQLException
Assignes a value into a PreparedStatement
- setCharArray in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setDate
public void setDate(PreparedStatement ps,
int idx,
Date o,
String columnType)
throws SQLException
Assignes a value into a PreparedStatement
- setDate in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setDouble
public void setDouble(PreparedStatement ps,
int idx,
double o)
throws SQLException
Assignes a value into a PreparedStatement
- setDouble in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setFloat
public void setFloat(PreparedStatement ps,
int idx,
float o)
throws SQLException
Assignes a value into a PreparedStatement
- setFloat in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setInt
public void setInt(PreparedStatement ps,
int idx,
int o)
throws SQLException
Assignes a value into a PreparedStatement
- setInt in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setLong
public void setLong(PreparedStatement ps,
int idx,
long o)
throws SQLException
Assignes a value into a PreparedStatement
- setLong in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setNull
public void setNull(PreparedStatement ps,
int idx,
int sqlType)
throws SQLException
Assignes a null value into a PreparedStatement
- setNull in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatementsqlType
- is the type of the column
setOboolean
public void setOboolean(PreparedStatement ps,
int idx,
Boolean o)
throws SQLException
Assignes a value into a PreparedStatement
- setOboolean in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setObyte
public void setObyte(PreparedStatement ps,
int idx,
Byte o)
throws SQLException
Assignes a value into a PreparedStatement
- setObyte in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setOchar
public void setOchar(PreparedStatement ps,
int idx,
Character o)
throws SQLException
Assignes a value into a PreparedStatement
- setOchar in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setOdouble
public void setOdouble(PreparedStatement ps,
int idx,
Double o)
throws SQLException
Assignes a value into a PreparedStatement
- setOdouble in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setOfloat
public void setOfloat(PreparedStatement ps,
int idx,
Float o)
throws SQLException
Assignes a value into a PreparedStatement
- setOfloat in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setOint
public void setOint(PreparedStatement ps,
int idx,
Integer o)
throws SQLException
Assignes a value into a PreparedStatement
- setOint in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setOlong
public void setOlong(PreparedStatement ps,
int idx,
Long o)
throws SQLException
Assignes a value into a PreparedStatement
- setOlong in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setOshort
public void setOshort(PreparedStatement ps,
int idx,
Short o)
throws SQLException
Assignes a value into a PreparedStatement
- setOshort in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setSerialized
public void setSerialized(PreparedStatement ps,
int idx,
Serializable o)
throws SQLException,
IOException
Assignes a value into a PreparedStatement
- setSerialized in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setShort
public void setShort(PreparedStatement ps,
int idx,
short o)
throws SQLException
Assignes a value into a PreparedStatement
- setShort in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
setString
public void setString(PreparedStatement ps,
int idx,
String o)
throws SQLException
Assignes a value into a PreparedStatement
- setString in interface PreparedStatementAdapter
ps
- is the PreparedStatementidx
- is the index of the the value in the PreparedStatemento
- is the value to assign
sqldate2date
private static Date sqldate2date(java.sql.Date d)
time2date
private static Date time2date(java.sql.Time t)
timestamp2date
private static Date timestamp2date(java.sql.Timestamp tstamp)