@Target(value=FIELD) @Retention(value=RUNTIME) public @interface ForeignCollectionField
ForeignCollection
field in a class that corresponds to objects in a foreign
table that match the foreign-id of the current class.
@ForeignCollection(id = true) private ForeignCollection<Order> orders;
Modifier and Type | Fields and Description |
---|---|
static int |
DEFAULT_MAX_EAGER_LEVEL |
Modifier and Type | Optional Element and Description |
---|---|
String |
columnName
The name of the column.
|
boolean |
eager
Set to true if the collection is a an eager collection where all of the results should be retrieved when the
parent object is retrieved.
|
String |
foreignFieldName
Name of the _field_ (not the column name) in the class that the collection is holding that corresponds to the
entity which holds the collection.
|
int |
maxEagerLevel
Set this to be the number of times to expand an eager foreign collection's foreign collection.
|
boolean |
orderAscending
If an order column has been defined with
orderColumnName() , this sets the order as ascending (true, the
default) or descending (false). |
String |
orderColumnName
The name of the column in the object that we should order by.
|
public static final int DEFAULT_MAX_EAGER_LEVEL
maxEagerLevel()
public abstract boolean eager
Set to true if the collection is a an eager collection where all of the results should be retrieved when the parent object is retrieved. Default is false (lazy) when the results will not be retrieved until you ask for the iterator from the collection.
NOTE: If this is false (i.e. we have a lazy collection) then a connection is held open to the database as
you iterate through the collection. This means that you need to make sure it is closed when you finish. See
LazyForeignCollection.iterator()
for more information.
WARNING: By default, if you have eager collections of objects that themselves have eager collections, the
inner collection will be created as lazy for performance reasons. If you need change this see the
maxEagerLevel()
setting below.
public abstract int maxEagerLevel
public abstract String columnName
Dao.getEmptyForeignCollection(String)
or when you want to specify it in
QueryBuilder.selectColumns(String...)
.public abstract String orderColumnName
public abstract boolean orderAscending
orderColumnName()
, this sets the order as ascending (true, the
default) or descending (false).public abstract String foreignFieldName
WARNING: Due to some internal complexities, this it field/member name in the class and _not_ the column-name.
This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.