I really like immutables.github.io's immutables:value annotation processor (@Value.Immutable, @Value.Modifiable, et al). I have a project using hibernate with quite a few entities. I'd love to have builders generated for me by the immutables library. Has anyone had any luck achieving this?
Say I have an entity
@Entity
public class Entity {
@Column String value;
}
There are a couple of general approaches that seem kind of sensible:
- Somehow tell
@Value.Modifiableto apply the annotations to the concreteModifiableEntitytype instead of the soon-to-be abstractEntityclass. - Tell hibernate to use a different concrete class (somewhat akin to
@JsonDeserialize(as=ModifiableEntity.class)).
But I can't work out how to achieve either of those approaches. Does anyone know of an approach that might work?