I hope this is the right forum - please let me know if it isn't.
I am having some trouble with CriteriaQuery - I have a table with a primary key that is composed of three columns; I have created an entity class:
---------------------------------------
public class ItemDescr implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
protected ItemDescrPK itemDescrPK;
...
@Embeddable
public class ItemDescrPK implements Serializable {
@Basic(optional = false)
@NotNull
@Column(name = "itemid")
private int itemid;
@Basic(optional = false)
@NotNull
@Column(name = "atid")
private int atid;
...
---------------------------------------
And the corresponding @StaticMetamodel classes:
---------------------------------------
@StaticMetamodel(ItemDescr.class)
public class ItemDescr_ {
public static volatile SingularAttribute
public static volatile SingularAttribute
...
@StaticMetamodel(ItemDescrPK.class)
public class ItemDescrPK_ {
public static volatile SingularAttribute
public static volatile SingularAttribute
public static volatile SingularAttribute
...
---------------------------------------
I would have thought that I should be able to address *atid* in ItemDescrPK_ like this:
---------------------------------------
itd = em.createQuery(
itdq.select(itdr)
.where(
builder.equal(itdr.get(ItemDescr_.itemDescrPK.atid)), ...
---------------------------------------
However, it gives a syntax error; or rather, NetBeans marks this as an error, saying:
---------------------------------------
cannot find symbol
symbol: variable atid
location: variable itemDescrPK of type SingularAttribute
---------------------------------------
Isn't this the way it is supposed to be, then? Or, rather, what is the right way?