ijgen.generator.annotations
Annotation Type Relation
@Target(value=FIELD)
@Retention(value=RUNTIME)
public @interface Relation
Annotation which describes relation between classes. Applicable only for fiels.
Its goal is to carry information about foreign key based relations.
One to one, One to many, Many to one, Many to many are the relation types
that are currently supported.
Set of attributes:
1. relationType: Specifies the type of the relation for this field.
Attribute is mandatory!
Possible types are:
RelationType.ONE_TO_ONE
RelationType.ONE_TO_MANY
RelationType.MANY_TO_ONE
RelationType.MANY_TO_MANY
2. joinTable: specifies the table that contains the data for the
foreign key pointed by this field.
Attribute is not mandatory, default value is empty string.
If not specified a default value is used by the generator which in
fact is the name of the field type.
3. joinColumn: specifies the column name from the join table which is
used to make the relation.
Attribute is not mandatory, default value is empty string.
If not specified a default value is used by the generator which in
fact is the name of the field.
Example: Let's consider that we have class "A" and we have
the following annotation on field "foreign":
Relation (relationType=RelationType.ONE_TO_MANY).
B foreign;
The above means that we'll have relation One to Many and it will be assumed
that the join table will have name "b" and the join column will have name "foreign"
Relation (relationType=RelationType.ONE_TO_MANY, joinTable="jtable", joinColumn="jcolumn").
B foreign;
The above means that we'll have relation One to Many and it will be assumed
that the join table will have name "jtable" and the join column will have name "jcolumn"
- Author:
- Detelin Zlatev
relationType
public abstract RelationType relationType
joinTable
public abstract java.lang.String joinTable
- Default:
- ""
joinColumn
public abstract java.lang.String joinColumn
- Default:
- ""
Copyright © 2010 Detelin Zlatev. All Rights Reserved.