I Have Object Master Location and MasterCountries
MasterLocation.java
@Entity
@Table(name = "master_location", schema = "public", catalog = "master_db")
@NamedEntityGraphs({
@NamedEntityGraph(name = "MasterLocation.joinsWithMasterCountries",attributeNodes = {
@NamedAttributeNode("masterCountriesByCountryCode")
}),
@NamedEntityGraph(name = "MasterLocation.noJoins",attributeNodes = {})
})
public class MasterLocation {
private String locationCode;
private String locationName;
private String countryCode;
private Integer agencyCode;
private String port;
private String place;
private String userId;
private Timestamp dateCreated;
private Timestamp lastModified;
private String portRefFrom;
private String portRefTo;
private String valid;
private String regionCode;
private String bookingRef;
private MasterCountries masterCountriesByCountryCode;
@ManyToOne(fetch = FetchType.LAZY)
@NotFound(action = NotFoundAction.IGNORE)
@JoinColumn(referencedColumnName = "iso_3166_1_alpha_2_code", name = "country_Code")
public MasterCountries getMasterCountriesByCountryCode() {
return masterCountriesByCountryCode;
}
}
MasterLocationRepository.java
@Repository
public interface MasterLocationRepository extends JpaRepository<MasterLocation, Integer> {
@EntityGraph(value = "MasterLocation.noJoins",type = EntityGraph.EntityGraphType.LOAD)
Page<MasterLocation> findByLocationNameLikeIgnoreCase(String locationName, Pageable pageable);
}
Why Object MasterCountries still load on findByLocationNameLikeIgnoreCase? How to disable Fetch MasterCountries in this repository?
Thanks