-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: AliasToBean ResultTransformer for CompositePrimaryKey
PostPosted: Tue Apr 01, 2014 7:45 am 
Newbie

Joined: Wed Nov 27, 2013 1:53 am
Posts: 6
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?


Top
 Profile  
 
 Post subject: Re: AliasToBean ResultTransformer for CompositePrimaryKey
PostPosted: Tue Apr 22, 2014 4:10 am 
Newbie

Joined: Wed Nov 27, 2013 1:53 am
Posts: 6
Just would like to understand the magic around the implementation of this requirement. Anybody has any points/ suggestions to achieve this??


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.