java - JPA: How can I Select @Embeddable Class -


i select columns @embeddable class certification. cann't select it. how can select embeddable class.

@entity public class department implements serializable {     private static final long serialversionuid = 1l;   @id   @generatedvalue(strategy = generationtype.auto)   private long id;   private string name;    @elementcollection   @collectiontable(name = "certification", joincolumns = {@joincolumn(name="user_id")})   private list<certification> certifications = new arraylist<certification>();    public list<certification> getcertifications() {       return certifications;   }    public void setcertifications(list<certification> certifications) {       this.certifications = certifications;   }     public string getname() {       return name;   }    public void setname(string name) {       this.name = name;   }    ..... 

@embeddable class certification

@embeddable public class certification{    private string name;   private string certart;    public string getname() {       return name;   }    public void setname(string name) {       this.name = name;   }      public string getcertart() {       return certart;   }    public void setcertart(string certart) {       this.certart = certart;   }    ...... 

if run resultservice following exception:

caused by: java.lang.illegalargumentexception: exception occurred while creating query in entitymanager: exception description: error compiling query [select c certification c]. unknown entity type [certification].

how can select @embeddable class?

you need retrieve certification via real entity class i.e. department. 1 example query below:

   select cer department dep join dep.certifications cer 

alternatively, may want retrieve qualifying department entities , fetch certifications using them.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -