Bom dia Pessoal, tenho o seguinte cenario:
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "georef_point_x_stretch", joinColumns = { @JoinColumn(name = "stretch_id", referencedColumnName = "id") })
private Set<GeorefPoint> georefPoint;
----
HashSet<GeorefPoint> hsc1 = new HashSet<GeorefPoint>();
for(Ponto post: trecho.getPontos()) {
hsc.add(new Cliente("Pedro de Lara","Rua 20 de março","7568-8524"));*/
}
stretch.setGeorefPoint(hsc1);
try {
stretchRepository.save(stretch);
} catch (Exception e) {
System.out.println("sdafdsafsd"+e.getMessage());
}
Esta dando o erro abaixo, quando salva o obj.
org.springframework.dao.InvalidDataAccessApiUsageException: Multiple representations of the same entity [br.com.inspecao.order.entity.GeorefPoint#1]
are being merged. Detached: [br.com.inspecao.order.entity.GeorefPoint@6724b51e]; Detached: [br.com.inspecao.order.entity.GeorefPoint@dd570146];
nested exception is java.lang.IllegalStateException:
Multiple representations of the same entity [br.com.inspecao.order.entity.GeorefPoint#1]
are being merged. Detached: [br.com.inspecao.order.entity.GeorefPoint@6724b51e]; Detached: [br.com.inspecao.order.entity.GeorefPoint@dd570146]
Alguém pode me ajudar ??