de.mathema.pride
Class JoinedRecordDescriptor
java.lang.Object
de.mathema.pride.RecordDescriptor
de.mathema.pride.JoinedRecordDescriptor
public class JoinedRecordDescriptor
- extends RecordDescriptor
ATTENTION: THIS CLASS IS STILL IN WORK!!!
Example use in JoinedCustomer:
RecordDescriptor red = new JoinedRecordDescriptor(
JoinedCustomer.class, JOIN, new Object[][] {
{ Customer.red, "cst", null, null },
{ Customer.red, "wife", "getWife", "setWife" }
});
- Author:
- Administrator
|
Constructor Summary |
JoinedRecordDescriptor(java.lang.Class objectType,
java.lang.String dbtable,
java.lang.Object[][] descriptorMap)
|
|
Method Summary |
protected java.lang.String |
getResultFields()
Returns the list of fields to be looked up in a query, which is by
default the list of all fields registered in this descriptor and
its base descriptors and thus the same list as returned by
RecordDescriptor.getFieldNames(java.lang.String[]). |
int |
record2object(java.lang.Object obj,
java.sql.ResultSet results,
int position)
Extract result values from a result set according to the field mappings
The extraction is by default performed in auto-mode. i.e. first by-name
if possible and by-index otherwise. |
| Methods inherited from class de.mathema.pride.RecordDescriptor |
getConstraint, getConstraint, getContext, getCreationValues, getCreationValues, getFieldNames, getObjectType, getPrimaryKey, getPrimaryKeyField, getTableName, getUpdateValues, getUpdateValues, getUpdateValues, getWhereValue, getWhereValue, record2object, record2object, totalAttributes, trim |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parts
protected JoinedRecordDescriptor.Part[] parts
JoinedRecordDescriptor
public JoinedRecordDescriptor(java.lang.Class objectType,
java.lang.String dbtable,
java.lang.Object[][] descriptorMap)
getResultFields
protected java.lang.String getResultFields()
- Description copied from class:
RecordDescriptor
- Returns the list of fields to be looked up in a query, which is by
default the list of all fields registered in this descriptor and
its base descriptors and thus the same list as returned by
RecordDescriptor.getFieldNames(java.lang.String[]).
Overriding this function must be done with great care. The extraction
of data from a result set in RecordDescriptor.record2object(java.lang.Object, java.sql.ResultSet, int, de.mathema.pride.AttributeDescriptor)
is performed by index and relies on the number and order of
fields defined by this function. If it returns '*' for example, make
shure to call AttributeDescriptor#record2object with index -1
to force data extraction by name.
- Overrides:
getResultFields in class RecordDescriptor
record2object
public int record2object(java.lang.Object obj,
java.sql.ResultSet results,
int position)
throws java.sql.SQLException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
- Description copied from class:
RecordDescriptor
- Extract result values from a result set according to the field mappings
The extraction is by default performed in auto-mode. i.e. first by-name
if possible and by-index otherwise. This is the only reliable way in all
JDBC drivers to support not only access of single tables but also joins
and alias fields. Joins turned out to cause some JDBC drivers to provide
no field names at all in the ResultSet. Alias names for function-based
fields turned out not to be provided in a reliable order.
The index-based extraction requires function {RecordDescriptor#getResultFields}
to provide the attributes in the same order they are traversed by this
function.
- Overrides:
record2object in class RecordDescriptor
- Parameters:
obj - The objet where to transfer the data toresults - The result set to extract the data fromposition - The start index for data extraction
- Returns:
- The next index for subsequent extractions or -1 to force
extraction by name (see class
AttributeDescriptor for details).
- Throws:
java.sql.SQLException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException