Thank you for your answers. I continued to experiment, and here is what I got:
@Entity @Table(name = "paper_cheque_stop_metadata") @org.hibernate.annotations.Entity(mutable = false) public class PaperChequeStopMetadata implements Serializable, SecurityEventAware { private static final long serialVersionUID = 1L; @SuppressWarnings("unused") @Id @Column(name = "paper_cheque_id") @AccessType("property") private long id; @OneToOne(cascade = {}, fetch = FetchType.EAGER, optional = false, targetEntity = PaperCheque.class) @PrimaryKeyJoinColumn(name = "paper_cheque_id") @JoinColumn(name = "paper_cheque_id", insertable = true) @NotNull private PaperCheque paperCheque; @XmlAttribute(namespace = XMLNS, name = "paper-cheque-id", required = true) public final long getId() { return this.paperCheque.getId(); } public final void setId(long id) {
This, by all means, is a disgusting hack, but it gets everything I wanted. PaperCheque property attributes as usual (not shown). I ran into such a OneToOne unidirectional mapping problem and decided to solve much more complex solutions, but this time I decided that I was going to find out, so I continued to crack it. Once again, thank you both for your answers, this is very much appreciated.
source share