0

Following writing hessian serivce I have setup Hessian webservice in my spring application and its working.

Using org.springframework.remoting.caucho.HessianServiceExporter - SpringFramework 3.1, Hessian 4.0.1,

public interface RetailService {
    List<User> getUserList();
}

@Component
public class RetailServiceImpl implements RetailService {
    public List<User> getUserList() {
        List<User> list=//get from db
        return list;
    }
}

class User{
    String name,otherFields;

    //Exclude this from serialization
    Role role;
}

How to exclude some fields from getting serialized. I could write a wrapper/inherited class excluding Role ,But I prefer something simple(like annotation) using the existing class itself.

Community
  • 1
  • 1
yodhevauhe
  • 735
  • 3
  • 10
  • 30

1 Answers1

1

Use transient - a keyword which prevents the field from serialization :

transient Role role;

Refer this link for more.

Community
  • 1
  • 1
Abubakkar
  • 15,090
  • 6
  • 52
  • 80
  • Working,But is there anything else specify to hessian so that role is available for normal serialization by other modules? – yodhevauhe Nov 23 '12 at 14:33