Since no one has posted im going to assume I wasnt clear. Here is my entity and PK classes.
Code:
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.portlet.ActionRequest;
import com.burris.ssapp.common.Input;
@Entity
@Table( name = "Items")
@IdClass( ItemPK.class )
public class Item {
// Primary key
private String supplierID;
private String caseGTIN;
// Other Database properties
...
public Item() {
}
/**
* Getters
*/
@Id
@Column( name = "SupplierID" )
public String getSupplierID() {
return this.supplierID;
}
@Id
@Column( name = "CaseGTIN" )
public String getCaseGTIN() {
return this.caseGTIN;
}
// Other getters and setters
...
}
----------------------------------------------------------------------------------
import java.io.Serializable;
import javax.persistence.Embeddable;
@Embeddable
public class ItemPK implements Serializable {
private static final long serialVersionUID = 9816235861478365L;
private String supplierID;
private String caseGTIN;
public String getSupplierID() {
return this.supplierID;
}
public String getCaseGTIN() {
return this.caseGTIN;
}
public void setSupplierID( String supplierID ) {
this.supplierID = supplierID;
}
public void setCaseGTIN( String caseGTIN ) {
this.caseGTIN = caseGTIN;
}
public boolean equals( Object obj ) {
// equals implementation
}
public int hashCode() {
// hashCode implementation
}
}
I think I have annotated them correctly, however, the primary key data does not show up in the ClassMetadata class. Heres what I get for the metadata:
Code:
[0] "_identifierMapper"
[1] "length"
[2] "status"
[3] "itemName"
[4] "width"
[5] "height"
[6] "itemDescription"
[7] "warehouseLocation"
[8] "storageAccount"
[9] "itemUOM"
[10] "brand"
[11] "itemClass"
[12] "owned"
[13] "packagePack"
[14] "packageSizeDescription"
[15] "packageUOM"
[16] "packageGTIN"
[17] "casePack"
[18] "caseSizeDescription"
[19] "caseUOM"
[20] "netWeight"
[21] "tare"
[22] "grossWeight"
[23] "weightUOM"
[24] "cube"
[25] "cubeUOM"
[26] "casesPerLayer"
[27] "layersPerPallet"
[28] "POUOM"
[29] "guaranteedSale"
[30] "freightAmount"
[31] "freightPercent"
[32] "freightUOM"
[33] "price"
Notice how CaseGTIN and SupplierID are missing. Any thoughts on how to gain access to these? I have tried the getIdentifierPropertyName() but it returns null. Im not sure if there is anything I can do with the Identifier mapper.