Let's say I have the following example entities - one is an @Embeddable, embedded inside another @Entity:
@Embeddable
public class ContactInfoEntity {
@Column
private String phone;
@Column
private String zipCode;
}
@Entity
@Table(name = "EMPLOYEE")
public class EmployeeEntity {
@Id
@Column(name = "EMPLOYEE_ID")
private Long employeeId;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "phone",
column = @Column(name = "EMPLOYEE_PHONE")),
@AttributeOverride(name = "zipCode",
column = @Column(name = "EMPLOYEE_ZIP_CODE"))
})
private ResourceNodeEntity employeeContactInfo;
}
Now suppose I want to do this:
Select the
EMPLOYEE_IDandEMPLOYEE_PHONEwhere theEMPLOYEE_ZIP_CODEis equal to "123456"
The meta-model classes generated by the openjpa-maven-plugin include only an employeeContactInfo variable, not the actual required columns.
So how do I create this as a CriteriaQuery which includes these @AttributeOverride columns?
Aucun commentaire:
Enregistrer un commentaire