I am working on an application which uses hibernate. When the object is returned from hibernate.,it is no longer a pojo.. there is something like cglibenhancer attached to it. because of it i cannot do any operations on it. i need to convert it to a java poja again. for this i am using hibernatebeanreplicator. what it does is that if the class had cglibenhancer attached to it.. it makes the object null. The problem comes when i am fetching just one or two properties of that object and i want to use them,but cos the class has cglibenhancer attached to it,it makes it null.. I want that only those properties which are not fetched should be mae null. let me make the scenario more clear with an example.
I have a class User
class User {
long id;
String name;
Address address;
}
I have another class address
class Address {
long addrId;
String streetName;
String city;
}
In my maping for User class , i store the addrId as a foreign key. Now i want to fetch user class data +address id only. but because i have not loaded the address class completely and it attaches cglibenhancer to it and my beanreplicator makes it null.
Is there a way to fetch the user class data+address id and make streetName and city null.
Thanks in advance,
Rima Desai