Rima T Desai
unread,Jul 7, 2009, 8:26:02 AM7/7/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to beanlib
I am working on a application which uses hibernate. I am using
hibernatebeanreplicator to convert the proxy data from hibernate to
null values. I want to just make few variables to null rather than
making the whole class null. how can it be achieved.
I am providing an example here.
Class A {
B b;
}
class B {
int id;
String name;
}
When i am fetching A it makes the object of B as null. I want to make
just name of B to null as i need to use the id from class B.
Here is what i am using to convert the proxy data .
HibernateBeanReplicator replicator = new Hibernate3BeanReplicator
() .initCustomTransformerFactory(conversionUtil.new Factory()); return
replicator.copy(src);
}
public class LazyHibernateCustomBeanTransformer implements
CustomBeanTransformerSpi {
public <T> boolean isTransformable(Object from, Class<T>
toClass,
PropertyInfo propertyInfo) { // apply custom
transformation for
// the uninitialized properties
return !Hibernate.isInitialized(from);
}
public <T> T transform(Object in, Class<T> toClass,
PropertyInfo propertyInfo) {
return null;
}
}
/** The factory for a {@link LazyHibernateCustomBeanTransformer}. */
public class Factory implements CustomBeanTransformerSpi.Factory {
public CustomBeanTransformerSpi newCustomBeanTransformer(
BeanTransformerSpi contextBeanTransformer) {
return new LazyHibernateCustomBeanTransformer();
}
}
Is there a method or way in beanlib to meet my requirement.
Thanks in advance,
Rima