1

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.Modifiable to apply the annotations to the concrete ModifiableEntity type instead of the soon-to-be abstract Entity class.
  • 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?

Martin
  • 3,703
  • 2
  • 21
  • 43

0 Answers0