1

I have a JPA entity called Parent and inside that there is embeddedPrimary key as Child

@Entity
@Table(name = "PARENT")
@NamedQuery(?????)
public class Parent implements Serializable {

    @EmbeddedId
    private ChildPK child;
}

and

@Embeddable
public class ChildPK implements Serializable {

    @Column(name = "DEALERID")
    private String dealerId;

    @Column(name = "BRANDID")
    private Long brandId;
..
}

How can I write named Query in Parent class so that i can perform select on dealerId and brandId from ChildPk.

MiGo
  • 551
  • 2
  • 7
  • 17

1 Answers1

0

SELECT p FROM Parent p WHERE p.child.dealerId = ? and p.child.brandId=?