]
Gail Badner resolved HHH-4727.
------------------------------
Resolution: Duplicate
Assignee: Gail Badner
Add option to specify foreign key name on table with shared primary
key used in one-to-one relationship
---------------------------------------------------------------------------------------------------------
Key: HHH-4727
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4727
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.2
Reporter: Pavla Nováková
Assignee: Gail Badner
There is currently no way to specify (user friendly) foreign key name on table with
shared primary key used in One-to-One mapping. The most intuitive way would be to
accept @ForeignKey on property level (see the comment in the code below) or on entity
level (similar way to usage in joined inheritance) or last option may be add parameter in
foreign generator.
{code}
@Entity
public class ExampleEntity implements Serializable {
@Id
@GenericGenerator(name = "foreign-generator", strategy = "foreign",
parameters=@Parameter(name="property", value="parentExampleEntity"))
@GeneratedValue(generator = "foreign-generator")
private Long id;
...
@PrimaryKeyJoinColumn
@OneToOne(fetch=FetchType.LAZY, optional=false)
@org.hibernate.annotations.ForeignKey(name="parent_entity_fk") // this is
currently ignored
private ParentExampleEntity parentExampleEntity;
...
}
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: