Closed
Description
When an object is annotated with @entity, then Jackson doesn't serialize the id.
@Entity
public class Test implements Serializable {
@Id
private Long id;
private String attribute;
// getters, setters, toString, hashCode, equals, serialVersionUID, etc.
}
This will serialize to
{
"attribute" : "attribute"
}
Commenting out @Entity
will fix the serialization:
{
"id" : 1,
"attribute" : "attribute"
}
I've created a minimal project to demonstrate the problem here:
https://github.com/efenderbosch/spring-hibernate-jackson-error
Should I also submit this to the Hibernate project?
I'm using OpenJDK 1.7.0_65 on Ubuntu 14.04.
Metadata
Metadata
Assignees
Labels
No labels