Cascading relationship "@Any"

I have a column in an entity defined like this:

@Any(metaColumn=@Column(name="index_type"),fetch=FetchType.EAGER,optional=false)
@AnyMetaDef(idType="java.util.UUID", metaType="string", metaValues={
    @MetaValue(targetEntity=LocalPodcast.class, value="Local"),
    @MetaValue(targetEntity=RSSPodcast.class, value="RSS")
})
@JoinColumn(name="index_id",columnDefinition="CHAR(36)")
private PodcastIndex index;

      

When I try to store the values ​​of this entity type the associated index is not saved. I would like this to happen automatically. In other respects, I usually used cascade=CascadeType.ALL

in an annotation defining a link, but @Any

there is no cascading field in the annotation . How can I make this ratio automatically cascade? I am using Hibernate 5.

+3


source to share


1 answer


There is a separate annotation for cascading

. So you can use



@Cascade( org.hibernate.annotations.CascadeType.ALL )

      

+2


source







All Articles