I have defined a many-to-one relationship between my three entity classes catalogB, tableA and tableAB. tableAB has a primary key composite of tableA.tableAId  and catalogB.catalogBId, and I used the following code:
@Entity
@Table(name = "tableAB", schema = Constantes.SCHEMA_SOLICITUD,uniqueConstraints = {@UniqueConstraint(columnNames = { "tableAId  ", "catalogBId" }) })
public class TableAB implements Serializable {
    private static final long serialVersionUID = 6360131240770014903L;
    @Id
    @ManyToOne(optional = false)
    @JoinColumn(name = "tableAId", referencedColumnName = "tableAId")
    private TableAId tableAId;
    @Id
    @ManyToOne(optional = false)
    @JoinColumn(name = "catalogBId", referencedColumnName = "catalogBId")
    private CatalogBId catalogBId;
And that gives me an error:
Caused by: java.lang.IllegalArgumentException: This class [schema.TableAB ] does not define an IdClass
 
     
    