Package net.tangly.orm.imp
Class PropertyOne2One<T extends net.tangly.bus.core.HasOid,R extends net.tangly.bus.core.HasOid>
java.lang.Object
net.tangly.orm.imp.PropertySimple<T>
net.tangly.orm.imp.PropertyOne2One<T,R>
- Type Parameters:
T- class owning the propertyR- Class referenced by the property
public class PropertyOne2One<T extends net.tangly.bus.core.HasOid,R extends net.tangly.bus.core.HasOid> extends PropertySimple<T> implements Relation<T,R>
Models a property with at most one managed instance of a target entity. The following rules apply
- The name of the property identifies the field in the instance owning the property.
- THe name of the property is a column in the owning entity table with a BIGINT sql type.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PropertyOne2One(@NotNull java.lang.String name, @NotNull java.lang.Class<T> entity, @NotNull net.tangly.commons.lang.Reference<Dao<R>> type, boolean owned) -
Method Summary
Modifier and Type Method Description voiddelete(T entity)Deletes all the instances at the end of the relation.booleanisOwned()Returns flag indicating if the instances at the end of the relation are owned or not.voidretrieve(T entity, java.lang.Long fid)Retrieves all the instances at the end of the relation.Dao<R>type()Returns the DAO is charge of the objects at the end of the relation.voidupdate(T entity)Updates all the instances at the end of the relation.Methods inherited from class net.tangly.orm.imp.PropertySimple
entity, field, getConverter, jdbcType, name, sqlType
-
Constructor Details
-
Method Details
-
type
Description copied from interface:RelationReturns the DAO is charge of the objects at the end of the relation. Therefore only typed relations are supported. -
isOwned
public boolean isOwned()Description copied from interface:RelationReturns flag indicating if the instances at the end of the relation are owned or not. -
update
Description copied from interface:RelationUpdates all the instances at the end of the relation. -
retrieve
public void retrieve(@NotNull T entity, java.lang.Long fid) throws java.security.PrivilegedActionExceptionDescription copied from interface:RelationRetrieves all the instances at the end of the relation.- Specified by:
retrievein interfaceRelation<T extends net.tangly.bus.core.HasOid,R extends net.tangly.bus.core.HasOid>- Parameters:
entity- entity owning the relationfid- foreign key of the referenced entities. Currently in aN -> 1relation the fid is the oid of the referenced object, in a1 -> Nthe fid is the oid of entity- Throws:
java.security.PrivilegedActionException- if an error occurred when accessing field for foreign key or instance
-
delete
Description copied from interface:RelationDeletes all the instances at the end of the relation. Semantically this method performs only ifRelation.isOwned()returns true.
-