Hi all,
I've this error when I try to load a list of "Product" in a simple DataGrid :
Didn't receive an acknowledge message
Was expecting mx.messaging.messages.AcknowledgeMessage, but received null
After several tests I'm pretty sure now that it's a mapping issue, and as I'm not used to annotations, maybe it comes from here, here are my classes :
Product.java :
@Entity
@Table(name="product")
public class Product implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="product_id")
private long productId;
private String name;
@ManyToOne(optional = false, fetch = FetchType.EAGER)
@JoinColumn(name="category_id")
private Category category;
@OneToMany(mappedBy = "product", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Collection<Buy> clients;
...Getters & Setters...
}
Client.java
@Entity
@Table(name="client")
public class Client implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="client_id")
private long clientId;
private String name;
@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Collection<Buy> products;
public long getClientId() {
return clientId;
}
public void setClientId(long clientId) {
this.clientId = clientId;
}
...Getters & Setters...
}
Buy.java
@Entity
@Table(name="buy")
public class Buy implements Serializable
{
@EmbeddedId
private BuyId buyId;
@ManyToOne
@PrimaryKeyJoinColumn(name="product_id", referencedColumnName="product_id")
private Product product;
@ManyToOne
@PrimaryKeyJoinColumn(name="client_id", referencedColumnName="client_id")
private Client client;
@Temporal(value = TemporalType.DATE)
private Date date;
...Getters & Setters...
}
BuyId.java
public class BuyId implements Serializable
{
private long clientId;
private long productId;
...Getters & Setters...
}
Category doesn't matter because there's only an Id and an Name, the association between Product and Category is unidirectional, the real issue is when I try to retrieve my Products from the database, this error happen and as I said, I'm almost certain it comes from a mapping/annotation mistake...
Thanks.