Hi Users,
A basic question but somehow I got messed up with:
I am mapping a Set (might be a list) of entities to an object using a mapping table.
Code:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name="KW_TARGET_OPERATION_TEMPLATE_XREF", joinColumns={
@JoinColumn(name="TARGET_OPERATION_ID") }, inverseJoinColumns={
@JoinColumn(name="TEMPLATE_ID", referencedColumnName="TARGETING_TEMPLATE_ID") })
private Set<TargetingTemplateVO> templates = new HashSet<TargetingTemplateVO>();
Now, the @JoinTable --> KW_TARGET_OPERATION_TEMPLATE_XREF has a surrogate column for setting a surrogate primary key (other two columns are primary key together).
What I'm trying to do is to make sure hibernate set this surrogate key using a sequence I have (in the database).
What's the best way to achieve this?
Thanks a lot,
David Zonsheine