mapper = new ObjectMapper();
// When serializing entity JSON for events, we want to use a reduced number
// of fields nested objects, so enable the event and API HATEOAS filters:
SimpleFilterProvider filterProvider = new SimpleFilterProvider();
filterProvider.setFailOnUnknownId(false);
filterProvider = filterProvider.addFilter("PoolFilter",
new PoolEventFilter());
filterProvider = filterProvider.addFilter("ConsumerFilter",
new HateoasBeanPropertyFilter());
filterProvider = filterProvider.addFilter("EntitlementFilter",
new HateoasBeanPropertyFilter());
filterProvider = filterProvider.addFilter("OwnerFilter",
new HateoasBeanPropertyFilter());
filterProvider = filterProvider.addFilter("IdentityCertificateFilter",
SimpleBeanPropertyFilter.serializeAllExcept("cert", "key"));
filterProvider = filterProvider.addFilter("EntitlementCertificateFilter",
SimpleBeanPropertyFilter.serializeAllExcept("cert", "key"));
filterProvider = filterProvider.addFilter("PoolAttributeFilter",
SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "id"));
filterProvider = filterProvider.addFilter("ProductPoolAttributeFilter",
SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "productId", "id"));
filterProvider = filterProvider.addFilter("SubscriptionCertificateFilter",
SimpleBeanPropertyFilter.serializeAllExcept("cert", "key"));
mapper.setFilters(filterProvider);
Hibernate4Module hbm = new Hibernate4Module();
hbm.enable(Hibernate4Module.Feature.FORCE_LAZY_LOADING);