generics - Netbeans unchecked conversion for List<> -


i'm learning netbeans platform , i'm in process of following tutorial:

link netbeans tutorial

i've reached point of running prototype i'm getting following warning in output window:

warning: [options] bootstrap class path not set in conjunction -source 1.6 warning: no processor claimed of these annotations: javax.annotation.generated ~/bdmanager/customerviewer/src/org/shop/viewer/customerviewertopcomponent.java:53: warning: [unchecked] unchecked conversion        list<employee> resultlist = query.getresultlist();   required: list<employee>   found:    list 3 warnings 

my entitymanager follows:

entitymanager entitymanager = persistence.createentitymanagerfactory("customerlibrarypu").createentitymanager();        query query  = entitymanager.createnamedquery("employee.findall");         list<employee> resultlist = query.getresultlist();        (employee c : resultlist){            jtextarea1.append(c.getfirstname()+" "+c.getlastname()+"\n");        } 

referencing #4 in designing interface in tutorial, instead of list being list<customer>, list list<employee> entity class returning data table called employee in database.

how rid of warning?

that comes fact getresultlist() returns untyped list (a raw type) assigning typed list (where type parameter = employee):

java.util.list getresultlist()

execute select query , return query results untyped list.

more on generics , raw types here.

for suppressing warning can use @suppresswarnings("unchecked"). check example here , in other related stackoverflow answers on how it.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -