com.scooterframework.orm.activerecord
Class HasManyRecordRelation

java.lang.Object
  extended by com.scooterframework.orm.activerecord.RecordRelation
      extended by com.scooterframework.orm.activerecord.HasManyRecordRelation

public class HasManyRecordRelation
extends RecordRelation

HasManyRecordRelation class represents a has-many relation instance. For example, A has many B. In has-many relation, foreign key is hold by class B. Class A is the owner of the relation.


Field Summary
 
Fields inherited from class com.scooterframework.orm.activerecord.RecordRelation
associationDataMap, lastUsedOptions, owner, relation
 
Constructor Summary
HasManyRecordRelation(ActiveRecord owner, HasManyRelation relation)
           
 
Method Summary
 AssociatedRecords allAssociatedRecords(java.lang.String options, boolean refresh)
          Find the associated record.
protected  java.util.List<ActiveRecord> retrieveAssociatedDataList(java.lang.String options)
          Retrieves a list of associated ActiveRecord data.
 
Methods inherited from class com.scooterframework.orm.activerecord.RecordRelation
allAssociatedRecords, allAssociatedRecords, allAssociatedRecords, associatedRecord, associatedRecord, associatedRecord, associatedRecord, getAssociatedData, getFKDataMapForOther, getLastUsedOptions, getNullFKDataMapForOther, getOwner, getRelation, optionsChangedFromLastRetrieval, retrieveAssociatedData, retrieveAssociatedData, retrieveAssociatedDataList, setAssociatedData, setAssociatedData, setLastUsedOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HasManyRecordRelation

public HasManyRecordRelation(ActiveRecord owner,
                             HasManyRelation relation)
Method Detail

allAssociatedRecords

public AssociatedRecords allAssociatedRecords(java.lang.String options,
                                              boolean refresh)
Find the associated record. For example, "order" has many "lineitem".
 SQL: select * from lineitem where lineitem.order_id = ${order.id}
 

Overrides:
allAssociatedRecords in class RecordRelation
Parameters:
options - A string of options.
refresh - If true, refresh data from database
Returns:
AssociatedRecords

retrieveAssociatedDataList

protected java.util.List<ActiveRecord> retrieveAssociatedDataList(java.lang.String options)
Description copied from class: RecordRelation
Retrieves a list of associated ActiveRecord data. This method must be implemented by the subclass of this class for either has-many type or has-many-through type.

Overrides:
retrieveAssociatedDataList in class RecordRelation
Parameters:
options - options used in retrieving the record
Returns:
retrieved active record instance list