Does the current JPAContainer release support @Idlcass composite primary keys? I am trying to create a JPAContainer for an entity with a composite key the Class looks similar to this
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name=“Land”)
@IdClass(LandPK.class)
public class Land implements Serializable {
@Column(name=“iso2”, nullable=false, length=2)
@Id
private String iso2;
@Column(name=“iso3”, nullable=false, length=3)
@Id
private String iso3;
…
}
The primary key Class:
@Embeddable
public class LandPK implements Serializable {
@Column(name=“iso2”, nullable=false, length=2)
private String iso2;
@Column(name=“iso3”, nullable=false, length=3)
private String iso3;
}
And then trying to create a JPAContainer for a table
JndiAddressesImpl jndiAddressesImpl = new JndiAddressesImpl(Constants.USERTRANSACTION_JNDI,Constants.ENTITYMANAGER_JNDI);
JPAContainer lands = JPAContainerFactory.makeJndi(Land.class, jndiAddressesImpl);
Table table = new Table(“Test table”, lands);
But I get the following error:
org.hibernate.TypeMismatchException: Provided id of the wrong type for class … Land Expected: … LandPK, got class java.lang.String
I don’t know how to map the properties to the primary key class. Or is it even possible?
Any help appreciated.