mercredi 17 juin 2015

Change JPA entity @OneToMany to fetch from JAX-RS Service

First, my class:

public class Person {

    @OneToMany
    private List<Address> address; 
    ...
}

My problem is that I want to change from where I am getting the data, first I was getting from database and now I need to fetch from a service, but this probably will break my entity, because I will not have @OneToMany List but a List holding all the address's id.

There is a easier way to change JPA relationship to JAX-RS service? How I will fetch the data now? Maybe a AddressService where I pass all ids and the service return a List, can anyone here help me with a less painful solution?

Aucun commentaire:

Enregistrer un commentaire