java.lang.Object
org.tentackle.model.impl.ForeignKeyImpl
- All Implemented Interfaces:
Comparable<ForeignKey>,ForeignKey
Implementation of a foreign key.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionForeignKeyImpl(Entity referencingEntity, Attribute referencingAttribute, Entity referencedEntity, Attribute referencedAttribute, boolean composite) Creates a foreign key. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanGets the referenced attribute.Gets the referenced entity.Gets the entity that provides the table for the referenced entity.Gets the referencing attribute.Gets the referencing entity.Gets the entity that provides the table for the referencing entity.inthashCode()booleanReturns whether the reference is via a composite relation.voidsetComposite(boolean composite) sqlCreateForeignKey(Backend backend) Creates the foreign key creation sql code.toString()
-
Constructor Details
-
ForeignKeyImpl
public ForeignKeyImpl(Entity referencingEntity, Attribute referencingAttribute, Entity referencedEntity, Attribute referencedAttribute, boolean composite) Creates a foreign key.- Parameters:
referencingEntity- the referencing entityreferencingAttribute- the referenced entityreferencedEntity- the referenced entityreferencedAttribute- the referenced attributecomposite- true if cascade on delete and update
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<ForeignKey>
-
getReferencingEntity
Description copied from interface:ForeignKeyGets the referencing entity.- Specified by:
getReferencingEntityin interfaceForeignKey- Returns:
- the referencing entity
-
getReferencingAttribute
Description copied from interface:ForeignKeyGets the referencing attribute.- Specified by:
getReferencingAttributein interfaceForeignKey- Returns:
- the referencing attribute
-
getReferencedEntity
Description copied from interface:ForeignKeyGets the referenced entity.- Specified by:
getReferencedEntityin interfaceForeignKey- Returns:
- the referenced entity
-
getReferencedAttribute
Description copied from interface:ForeignKeyGets the referenced attribute.- Specified by:
getReferencedAttributein interfaceForeignKey- Returns:
- the referenced attribute
-
isComposite
public boolean isComposite()Description copied from interface:ForeignKeyReturns whether the reference is via a composite relation.- Specified by:
isCompositein interfaceForeignKey- Returns:
- true if composite
-
setComposite
public void setComposite(boolean composite) -
sqlCreateForeignKey
Description copied from interface:ForeignKeyCreates the foreign key creation sql code.- Specified by:
sqlCreateForeignKeyin interfaceForeignKey- Parameters:
backend- the backend to create sql code for- Returns:
- the SQL code
-
getReferencingTableProvidingEntity
Description copied from interface:ForeignKeyGets the entity that provides the table for the referencing entity.- Specified by:
getReferencingTableProvidingEntityin interfaceForeignKey- Returns:
- the entity, never null
-
getReferencedTableProvidingEntity
Description copied from interface:ForeignKeyGets the entity that provides the table for the referenced entity.- Specified by:
getReferencedTableProvidingEntityin interfaceForeignKey- Returns:
- the entity, never null
-
toString
-