Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Question about @BasicCollection and Primary Key

Given the following Entity

@Entity
@Table(name = "ATTRIBUTES")
public class AttributeDao {

  @Id
  @GeneratedValue(strategy=GenerationType.AUTO)
  @Column(name = "ATT_ID")
  private String _id;
  
  @Column(name = "ATT_NAME")
  private String _name;

  @BasicCollection (
    fetch=FetchType.EAGER,
    valueColumn=@Column(name="ATT_VALUE"))
    @CollectionTable (
        name="ATTRIBUTE_VALUES",
        primaryKeyJoinColumns=
        {@PrimaryKeyJoinColumn(name="ATT_ID",
referencedColumnName="ATT_ID")}
    )    
  private List<String> _values;
}

For _vales the following DDL is used to create the table:
CREATE TABLE "ATTRIBUTE_VALUES" ("ATT_ID" VARCHAR2(255) NOT NULL ENABLE,
"ATT_VALUE" VARCHAR2(255))

Is it somehow possible to define the following Primary Key definition
via annotations ?
PRIMARY KEY ("ATT_ID", "ATT_VALUE")

Bye,
Daniel


Back to the top