Hi,
Have you tried to map your
optional one-to-one association via a join table. I believe this is the recommended way in this case. There are two ways of achieving this. Either via with a @JoinTable or with @SecondaryTable.
The former could look like this:
Code:
@OneToOne(targetEntity = InfoAutoVerrechnungImpl.class, fetch = FetchType.LAZY, optional = true)
@JoinTable(
name = "INFO_AUTO_VERRECHNUNG",
joinColumns = @javax.persistence.JoinColumns({
@javax.persistence.JoinColumn(name = "MI0153A", referencedColumnName = "MI0153A", nullable = false, updatable = false, insertable = false),
@javax.persistence.JoinColumn(name = "MI1997A", referencedColumnName = "MI1997A", nullable = false, updatable = false, insertable = false) })
inverseJoinColumns = @JoinColumn(name = "???")
public InfoAutoVerrechnung getInfoAutoVerrechnung();
The book "Java Persistence with Hibernate" covers this type of mapping in more detail.
--Hardy