Embedded key problem - embedded attribute already exists?

Hi:

I am getting an error message (“embedded attribute already exists”) when I try to declare entities that link off the parts of an embedded primary key.

I’ve got the following embedded key:

@Embeddable
public class SuppitemsCompKey extends EmbeddableEntity {
    private static final long serialVersionUID = -8609278766069983640L;

    @Column(name = "PASID", nullable = false)
    private Long pasid;

    @Column(name = "OFFERID", nullable = false)
    private Long offerid;

and the following object that uses it:


@Table(name = "SUPPITEMS")
@Entity(name = "rade$Suppitem")
public class Suppitem extends BaseGenericIdEntity<SuppitemsCompKey> {
    private static final long serialVersionUID = 4333919297189514301L;

    @Column(name = "OFFERTYPE", length = 1)
    private String offertype;

    @EmbeddedId
    private SuppitemsCompKey id;

    @MapsId("pasid")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="PASID", referencedColumnName = "ID")
    private Customer customer;

    @MapsId("offerid")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="OFFERID", referencedColumnName = "ID")
    private Offer offer;

What is the correct way to declare the links to Customer and Offer so that Cuba Studio doesn’t complain about duplicate embedded attribute names?

Hi, Eric.

Unfortunately, Studio does not support such type of relations.
If you want to use the field as a part of composite PK and also as a link, create the update scripts manually.