Hello,
How may I model a relationship between an entity and one of its attributes which is a collection of the entity itself? For example, I have an entity called WorkflowStep, which may have a list of WorkflowSteps as an attribute.
Thanks.
Hello,
How may I model a relationship between an entity and one of its attributes which is a collection of the entity itself? For example, I have an entity called WorkflowStep, which may have a list of WorkflowSteps as an attribute.
Thanks.
Hi Jayant,
Just add the parent attribute which is a many-to-one reference to the same entity:
public class WorkflowStep extends StandardEntity {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PARENT_ID")
protected WorkflowStep parent;
...
}
You can find the example of such entity relationships and in our Sampler.
Thank you for your assistance.