java - How to solve compile errors in custom JpaRepositoryFactory after upgrade from Spring Data JPA 1.4 to 1.8? -
basically situation when want upgrade 1.8.0.release 1.4.5.release. i've noticed far this:
lockmoderepositorypostprocessor
has becomecrudmethodmetadatapostprocessor
lockmetadataprovider
has becomecrudmethodmetadata
now, have custom jpa repository factories , extend jparepositoryfactory
this:
class customjparepositoryfactory extends jparepositoryfactory { protected <t, id extends serializable> jparepository<?, ?> gettargetrepository{ simplejparepository<?, ?> repo; // custom code lockmoderepositorypostprocessor lockmodepostprocessor = lockmoderepositorypostprocessor.instance; repo.setlockmetadataprovider(lockmodepostprocessor.getlockmetadataprovider()); } }
this possible because lockmoderepositorypostprocessor
enum public. now, new crudmethodmetadatapostprocessor
package protected , same trick not work. realized can this:
super.gettargetrepository(metadata);
and in back-end happen:
repository.setrepositorymethodmetadata(lockmodepostprocessor.getlockmetadataprovider());
but seems way misleading. spring data jpa project?
prefer overriding jparepositoryfactory.gettargetrepository(repositorymetadata, entitymanager)
. method called jparepositoryfactory.gettargetrepository(repositorymetadata)
take care of populating repository instance created necessary crudmethodmetadata
.
Comments
Post a Comment