I think you should consider @ServerOnly and @ReadOnly annotations (a new feature of Gilead) : they are intented to exclude properties from clone and merge operations without having to call addProxyInformation.
HTH
Bruno
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't use this annotations because in some services i need an entity property on the client and in an other service i don't need the same property on the client.
I can't add or remove this annotaion at run time
I made a disconnector mechanism to disconnect specific propertys at runtime depending on the disconnect config.
my disconnector sets the property "roles" to null and then it adds this property "roles" as lazyProperty after that your method merge() and parseReturnValue() will be executed and my property is lazy even if there was a value there before.
With this i can dynamicly disconnect propertys at run time.
That mechanism worked properly for Hibernate4get and now i want convert it, that it works with Gilead too.
So I need to know how to set a property Lazy. like it was before in hibernate4gwt.
is this still possible ?
thx for your help
greetz Marco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In hibernate4gwt i had the Method "addLazyProperty(..)" in LazyPojo and it was possible to add a LazyPropertyField by this code:
lazyPojo.addLazyProperty("filedName");
how can I do that in Gilead?
i saw the Method "addProxyInformation()" in LightEntity
is this the same as the method above in hibernate4gwt ?
there are 2 Parameters String: propertyName and Map: ProxyInformations
paramter 1 is well it might be the name uf the field but what sould I insert in this map? Something that define it as LazyLoad
Thx for your help
greetz Marco
Hi Marco,
I think you should consider @ServerOnly and @ReadOnly annotations (a new feature of Gilead) : they are intented to exclude properties from clone and merge operations without having to call addProxyInformation.
HTH
Bruno
Hi Bruno
thx for your response.
I can't use this annotations because in some services i need an entity property on the client and in an other service i don't need the same property on the client.
I can't add or remove this annotaion at run time
I made a disconnector mechanism to disconnect specific propertys at runtime depending on the disconnect config.
For example:
EntityDisconnector entityDisconnector = (EntityDisconnector) Component.getInstance(EntityDisconnector.class, true);
FieldDisconnectorStrategy disconnectorStrategy=new FieldDisconnectorStrategy();
disconnectorStrategy.addAFieldToDisconnect("my.app.model.UserAccount.roles");
entityDisconnector.addDisconnectorStrategy(disconnectorStrategy);
UserAccount res=(UserAccount)entityDisconnector.disconnect(uc);
my disconnector sets the property "roles" to null and then it adds this property "roles" as lazyProperty after that your method merge() and parseReturnValue() will be executed and my property is lazy even if there was a value there before.
With this i can dynamicly disconnect propertys at run time.
That mechanism worked properly for Hibernate4get and now i want convert it, that it works with Gilead too.
So I need to know how to set a property Lazy. like it was before in hibernate4gwt.
is this still possible ?
thx for your help
greetz Marco
Yes, it is still possible.
I am out of office, so IO have not Gilead source code with me, but the equivalent code should look like :
user.addProxyInformation(ILightEntity.LAZY_INFORMATION, true);
(the exact code should be in CloneBeanPopulatable class)
Regards
Bruno
Hi Marco,
The exact code is :
Map<String, Serializable> proxyInformations;
proxyInformations = _persistenceUtil.serializeEntityProxy(fromValue);
proxyInformations.put(ILightEntity.INITIALISED, false);
user.addProxyInformation(property, convertSerializableToBytes(proxyInformations));
with following convertSerializableToBytes method :
protected Map<String, byte[]> convertSerializableToBytes(Map<String, Serializable>
{
// Precondition checking
//
if (map == null)
{
return null;
}
// Convert map
//
Map<String, byte[]> result = new HashMap<String, byte[]>();
for (Map.Entry<String, Serializable> entry : map.entrySet())
{
result.put(entry.getKey(),
SerializationManager.getInstance().serialize(entry.getValue()));
}
return result;
}
Hope this helps
Bruno