FasterXML / FasterXML/jackson-datatype-hibernate

Spring Controller annotated with @JsonView and hibernate5 return null

Open
#118 2 comments 0 reactions 0 assignees View on GitHub
need-test-case
Dominant language
Java
Stars
331
Forks
108
Avg merge
5h 3m
Merged PRs (30d)
1

Description

I think it's similar issue #73

With Spring along @JsonView all Lazy fields will be initiated and serialized,
but when integrate hibernate5 module, the returned value is null (example relEntity return value is null) .

```
@Entity
@Table(name = "my_table")
public class MyEntity {
...
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JsonView(Views.Public.class)
private RelatedEntity relEntity;
...
}
```

Call from some Spring Rest controller:

```
@JsonView(Views.Public.class)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public MyEntity getObject(@PathVariable(name = "id") UUID id) {
return service.findByUuid(id);
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.