Hi,
My class file is below.
Code:
public class Ogmdevice implements java.io.Serializable {
private OgmdeviceId id;
private Schedules schedules;
private ObjectGroups objectGroups;
public Ogmdevice(OgmdeviceId id, Schedules schedules, ObjectGroups objectGroups) {
this.id = id;
this.schedules = schedules;
this.objectGroups = objectGroups;
}
public OgmdeviceId getId() {
return this.id;
}
public void setId(OgmdeviceId id) {
this.id = id;
}
public Schedules getSchedules() {
return this.schedules;
}
public void setSchedules(Schedules schedules) {
this.schedules = schedules;
}
public ObjectGroups getObjectGroups() {
return this.objectGroups;
}
public void setObjectGroups(ObjectGroups objectGroups) {
this.objectGroups = objectGroups;
}
}
Code:
public class OgmdeviceId implements java.io.Serializable {
private String deviceId;
private String objectGroupId;
public OgmdeviceId() {
}
public OgmdeviceId(String deviceId, String objectGroupId) {
this.deviceId = deviceId;
this.objectGroupId = objectGroupId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getObjectGroupId() {
return this.objectGroupId;
}
public void setObjectGroupId(String objectGroupId) {
this.objectGroupId = objectGroupId;
}
}
Schedules and ObjectGroups has separate class file for getter setters.
I need to fetch the deviceId, objectGroupId from Ogmdevice. As Both deviceId and objectGroupId are composite primary keys, When i use query.setResultTransformer(Transformers.aliasToBean(Ogmdevice.class)), I am not getting the alias data instead getting
Quote:
org.hibernate.PropertyNotFoundException: Could not find setter for DeviceId on class se.info24.pojo.Ogmdevice
How to use Aliastobean for composite primary keys?