Blazebit / blaze-persistence

Rich Criteria API for JPA providers
https://persistence.blazebit.com
Apache License 2.0
697 stars 85 forks source link

Support for HATEOAS RepresentationModel link relation naming #1862

Open mj-p opened 4 months ago

mj-p commented 4 months ago

Hello, is there support for annotations to be added to the generated EntityView classes? In my case I would like to use the HATEOAS models wrapping my EntityViews like this:

PagedModel<EntityModel<GroupView>> findAll(Pageable pageable, PagedResourcesAssembler<GroupView> assembler) {
  return assembler.toModel(groupViewRepository.findAll(pageable));
}

The only "problem" I have now is the HAL representation uses the proxy class name like:

{
  "_embedded": {
    "groupView_$$_javassist_entityview_s": [...]
  },
  // links and page stuff
}

This is where I would like to use @Relation(collectionRelation = "groups") to overrule the naming instead of messing with RelProviders or MessageConverters like described here: https://docs.spring.io/spring-hateoas/docs/current/reference/html/#server.rel-provider

Maybe I am missing something obvious, help appreciated.

beikov commented 4 months ago

Hi, I'm no expert in Spring HATEOAS, but maybe @ask4gilles can help here?

mj-p commented 4 months ago

Despite this being a rather specific case with limited options provided by HATEOAS I guess it feeds into this issue (#1044)? Being able to have annotations on the generated implementation classes of your EntityViews would be a nice feature.