title: lazy objects not converted to null in Jackson ObjectMapper
body: <p>I'm using Spring 3.1.4 together with jackson-datatype-hibernate 2.2.3 and get my User-Object from JPA beginning from my REST-Service. So now mails is automatically fetched lazy. What I want is a JSON just with the name and mails is simply null.</p>
  
  <p>MyRest Method: </p>
  
  <pre><code>@Transactional(readOnly = true)
  @RequestMapping(
          value="/get/{userId}", 
          method = RequestMethod.GET,
          produces={"application/json","application/xml"}
          )
  @ResponseBody
  public User getUser(@PathVariable("userId") Long userId){
      User result = userManager.getUser(userId);
      return result;
  }
  </code></pre>
  
  <p>minimized User Class: </p>
  
  <pre><code>public class User{
  
      private String name;
  
      @OneToMany
      private Set&lt;Mail&gt; mails;
  }
  </code></pre>
  
  <p>Custom Jackson Object Mapper: </p>
  
  <pre><code>public class CustomJacksonObjectMapper extends ObjectMapper {
  
  public CustomJacksonObjectMapper() {
      super();
      this.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
      this.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
      this.setSerializationInclusion(Include.NON_NULL);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>which is initialized by </p>
  
  <pre><code>@Configuration
  @ComponentScan(basePackages = { "com.fabel" })
  public class SpringConfiguration extends WebMvcConfigurationSupport{
  
   @Bean
    public ObjectMapper objectMapper() {
          CustomJacksonObjectMapper objectMapper = new CustomJacksonObjectMapper();
      Hibernate4Module hibernate4Module = new Hibernate4Module();
      objectMapper.registerModule(hibernate4Module);
      return objectMapper;
    }
  
    @Override
    public void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) {
      MappingJackson2HttpMessageConverter converter = new                               MappingJackson2HttpMessageConverter();
     converter.setObjectMapper(objectMapper());
     converters.add(converter);
    }
  </code></pre>
  
  <p>}</p>
  
  <p>I orientated my implementation on the german blog <a href="http://blog.rasc.ch/?p=2441" rel="nofollow">http://blog.rasc.ch/?p=2441</a> and did everything mentioned. 
  Any ideas what I can do? 
  @JacksonIgnore is no option, because sometimes I need to send lazy objects. Then I would simply use Hibernate.initialize. What am I missing? </p>