Hi folks,
is it possible to avoid the creation of an FK constraint for an one-to-many association?
I have the following:
@OneToMany(cascade=CascadeType.ALL)
@JoinColumn(name="targetId")
@Where(clause="targetKind='P'")
private List<Review> reviews = new ArrayList<Review>();
The 'P' is acting as a discriminator here, between different review targets. The target of the review is in fact determined from a pair <discriminator,id>. So I really don't want that the id was constrained by a FK constraint (that id should for all purposes be a simple integer except for its use as a join field coupled with the discriminator).
But then I don't know how to tell hibernate that the FK is not meant to be generated, if this is possible at all. For the schema auto-generation I use:
<property name="hibernate.hbm2ddl.auto">update</property>
Any hints will be appreciated.
TIA.
Cheers,
Carlos
|