Is there a particular reason why your test case uses @ManyToOne relation mappings to String rather than an entity? Additionally, PurchaseOrdDetailPK must implement Serializable.