This is a spreadsheet context : are you writing a repository .store (entity) or entity.storeIn (repository)?
Each has its own merits. I usually prefer the .store repository (entity) for the main reason that I support the methods of my domain-oriented objects. It makes sense to write pen.dispenseInkOnto (Surface), because that's what pens do. It is a little less sense to write pen.storeIn (penRepository).
The downside is that you need to grant access to the internal elements of the object class to the persistence class. Besides getters that introduce the same problem as entity.storeIn (), I would go with a friend class protected by package access, internal access, or a friend class to restrict access to internal only to those who need it.
As a rule, a general injection of classes, in the example pen.dispenseInkOnto (Surface), you can make the Surface interface and use injection. I see no problem with this if you add other objects, value objects, or services.
source share