0

从 DTO 映射到休眠实体时,出现以下异常:

ma.glasnost.orika.MappingException: ma.glasnost.orika.impl.generator.CompilerStrategy$SourceCodeGenerationException: class com.exmaple.MyEntity_$$_jvst402_4 不可访问

该实体是公开的。

版本:

  • spring-boot-starter-data-jpa:1.4.0.RELEASE
  • 奥里卡:1.4.6
  • 休眠:5.0.9.Final。
4

1 回答 1

0

当映射配置不正确时,可能会发生此错误。该错误可能非常具有误导性。

导致错误的配置:

factory.classMap(MyEntity.class, MyEntity.class).byDefault().register();

修复

factory.classMap(MyEntity.class, MyEntityDTO.class).byDefault().register();

我考虑删除这个问题,因为它不是任何库的问题,但本质上是我的映射配置中的错字/copypasto。然而,出于XKCD最好描述的原因,我将让它保留。

于 2016-09-21T00:31:02.223 回答