@PalmyraForeignKey#
com.palmyralabs.palmyra.base.annotations.PalmyraForeignKey
Declares a foreign-key relationship to another Palmyra type. Target: TYPE. Retention: CLASS — consumed only through @PalmyraMappingConfig.foreignKeys.
Attributes#
| Attribute | Signature |
|---|---|
name |
String name() — FK name |
targetType |
String targetType() default "" — referenced entity type |
targetReference |
String targetReference() — reference identifier on the target |
sourceFields |
String[] sourceFields() default {} |
targetFields |
String[] targetFields() default {} |
Example#
@PalmyraMappingConfig(
type = "Order",
foreignKeys = {
@PalmyraForeignKey(
name = "fk_order_user",
targetType = "User",
targetReference = "user",
sourceFields = {"userId"},
targetFields = {"id"}
)
}
)
public class Order { }