mercredi 30 janvier 2019

Get JPA repository name dynamically by entity name

My requirement is , i want to call repository's method but i have entity name only. is it possible to get jpa repository name by entity name ?

for example :- i have one method

     void test (String entityName,Long id){

     // Here i want to fetch object of that entity by id
    // so for this first i have to find repository object and 
    // after that i will be able to call findById() method      

    i want something like that:- Object obj=repo.findById();
}

is it possible ?





Aucun commentaire:

Enregistrer un commentaire