What I need to do is list the suppliers that have responded to a single request. I make the query but I get the error (Object comparisons can only be used with OneToOneMappings. Other mapping comparisons must be done through query keys or direct attribute level comparisons)
The query I'm doing is like this
SELECT e.DataSupplier FROM Contribution e, Order f where e.idOppointed = 1
The contribution entity is like this
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "idAporte")
private Integer idAporte;
@Basic(optional = false)
@NotNull
@Column(name = "cantidadAportada")
private int cantidadAportada;
@Basic(optional = false)
@NotNull
@Column(name = "precioAporte")
private int precioAporte;
@JoinColumn(name = "idPedido", referencedColumnName = "idPedido")
@ManyToOne(optional = false)
private Pedido idPedido;
@JoinColumn(name = "idProducto", referencedColumnName = "codigoProducto")
@ManyToOne(optional = false)
private Producto idProducto;
@JoinColumn(name = "cedulaProveedor", referencedColumnName = "cedulaProveedor")
@ManyToOne(optional = false)
private Proveedor cedulaProveedor;
I know that the error is because I have a relationship between the Contributions and Orders tables and they are related by means of the column "requestid", therefore I can not send the 1, but I do not know how to send the order object that I have the id 1.
If you could help me, I would really appreciate it.