Reputation: 86885
@OneToOne
private AnyEntity entity;
hibernate
will create a mapping as follows:
CONSTRAINT fk_kcn86scsc0pasdasdngmrqc5i0 FOREIGN KEY (text_id)
REFERENCES some_table (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
Question: how can I set the constraint name explicit from within java?
I cannot introduce a bidirectional mapping, as the AnyEntity
class will be used in multiple other @Entity
classes.
Upvotes: 0
Views: 346
Reputation: 1034
You can use @ForeignKey
annotation.
@ForeignKey(name="constraint_name")
Upvotes: 3