Update Lazy Associate Entity Field Could not locate field name on LazyPropertyInitializer

I hava a entity

class Entity1{
@OneToOne(fetch = FetchType.LAZY,cascade = {REMOVE,MERGE})
  @ToString.Exclude
  private Entity2 entity2;
}

class Entity2{
private String name;
}

And when call entity1.getEntity2().setName(“xxx”) and repository.flush() or repository.merge(entity1)
The error is

Could not locate field name [id] on class [org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer$1]

Hello, your code doesn’t show enough to understand what’s going on here. If you think there might be a bug in Hibernate, please try to create a reproducer with our test case template and if you are able to reproduce the error you’re seeing, create a new ticket in our issue tracker and attach that reproducer