jeudi 31 octobre 2019

Error find object Spring JPA: "Error accessing field by reflection for persistent property"

I have the following classes:

@Entity(name = "focusoc_orbit")
@Data
public class OrbitAdapter extends Adapter{

  @Id
  private String              id;

  ...

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  ...

}

And,

@Entity(name = "focusoc_conjunction")
@Data
public class ConjunctionAdapter extends Adapter {

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long         id;

  @ManyToOne
  @JoinColumn(name = "target_id")
  private OrbitAdapter target;

  @ManyToOne
  @JoinColumn(name = "chaser_id")
  private OrbitAdapter chaser;

  ...
  public OrbitAdapter getTarget(){
    return target;
  }
  public void setTarget(OrbitAdapter target){
    this.target = target;
  }
  public String getChaserId(){
    return chaserId;
  }
  public void setChaser(OrbitAdapter chaser){
    this.chaser = chaser;
  }

  ...

}

Also I defined the Repository:

public interface ConjunctionRepository extends PagingAndSortingRepository<ConjunctionAdapter, Long> {
  public ConjunctionAdapter findByTargetAndChaserAndTimeOfCloseApproach(String target, String chaser, Date timeOfCloseApproach);
}

When I try to make the call,

ConjunctionAdapter c = conjunctionRepository.findByTargetAndChaserAndTimeOfCloseApproach(targetId, chaserId, timeOfCloseApproach());

It returns the error:

org.hibernate.property.access.spi.PropertyAccessException: Error accessing field [private java.lang.String gcs.fds.focusoc.adapter.OrbitAdapter.id] by reflection for persistent property [gcs.fds.focusoc.adapter.OrbitAdapter#id] : 02035A"

I tried a lot of differents solutions that I found but it does not work for me. Any help?





Aucun commentaire:

Enregistrer un commentaire