Question

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.

Était-ce utile?

La solution

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

transient Role role;

Refer this link for more.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top