Friday, July 12, 2013

how to clone shared object in gwt

Hi,

I want to implement audit mechanism for some entity of hibernate. Those entities are in shared package. That mean it will accessible for client and server both package.  
I am doing below steps to achieve audit feature:

->Entity has one variable which hold clone copy of itself 
Just example:

class Data implements Cloneable
{
Data oldData;

public Data getOldDataCopy() {
 return oldDataCopy;
}

public void setOldDataCopy() {
  try {
this.oldDataCopy = (Data) this.clone(); // This will clone this object when I ferxg
} catch (CloneNotSupportedException e) {  
e.printStackTrace();
}
}

}


So while any changes made in object then original copy remained as original stage. 
It throw exception like

[TRACE] [v4workflow] - Finding entry point classes
[ERROR] [v4workflow] - Errors in 'file:/E:/workspace/V4Common_V17/src/com/v4common/shared/beans/workflowengine/Data/Data.java'
[ERROR] [v4workflow] - Line 612: The method clone() is undefined for the type Data
[ERROR] [v4workflow] - Line 613: No source code is available for type java.lang.CloneNotSupportedException; did you forget to inherit a required module?
[ERROR] [v4workflow] - Unable to find type 'com.nextenders.client.WorkFlowEntryPoint'
[ERROR] [v4workflow] - Hint: Previous compiler errors may have made this type unavailable
[ERROR] [v4workflow] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] [v4workflow] - Failed to load module 'v4workflow' from user agent 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0' at pwd.mp.etenders.in:54479

but As I goggled then came to know that clone does not support with GWT. 
So is there any alternative other then clone? should I have to make copy of each property manually?

Thanks,
Bhumika

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment