I am getting below mentioned error when trying to access records from DB using a spring-data-jpa and spring-data-rest.
Cannot create self link for class [Ljava.lang.Object;! No persistent entity found!
I am using below query to retrieve information and my Class structure is somewhat as below
Agency
@OneToMany(mappedBy="agencyCode",cascade=CascadeType.ALL)
@JsonIgnore
List<Location> locations;
Location:
@ManyToMany
@JoinColumn(name = "zipCode")
Set<Zip> zips;
Zip:
@Id
@Column(name="zipCode")
String zipCode;
Query used to retrieve information is as below:
@Query("SELECT DISTINCT a, l.contactInfo.address.city, l.contactInfo.address.street, l.contactInfo.phone from Agency a, Location l INNER JOIN l.zips z where a.ceID = l.agencyCode and z.zipCode = :zip")
public List<Agency> findAgencyByZip(@Param("zip") String zip);
Any Help on this would be greatly appreciated.
Regards Chetan