No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor

后端 未结 8 1791
野的像风
野的像风 2020-12-04 15:15

When i try to navigat to an endpoint i get tho following error

Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddy

8条回答
  •  庸人自扰
    2020-12-04 16:09

    I came across this error while doing a tutorial with spring repository. It turned out that the error was made at the stage of building the service class for my entity.

    In your serviceImpl class, you probably have something like:

        @Override
        public YourEntityClass findYourEntityClassById(Long id) {
          return YourEntityClassRepositorie.getOne(id);
        }
    

    Change this to:

        @Override
        public YourEntityClass findYourEntityClassById(Long id) {
          return YourEntityClassRepositorie.findById(id).get();
        }
    

    It's because the getOne(), returns a reference.

提交回复
热议问题