I am receiving the following error message when I compile my code and I have no idea how to fix it. Please help.
Scanning for modules in C:\Program Files (x86)\NetBeans 7.2.1\platform
Scanning for modules in suite C:\Users\Me\Documents\SampleCRUDApp\Donor Info
init:
up-to-date:
compile:
Created dir: C:\Users\Me\Documents\SampleCRUDApp\Donor Info\DonorViewer\build\classes
Compiling 1 source file to C:\Users\Me\Documents\SampleCRUDApp\Donor Info\DonorViewer\build\classes
warning: No processor claimed any of these annotations: [javax.annotation.Generated]
C:\Users\Me\Documents\SampleCRUDApp\Donor Info\DonorViewer\src\org\shop\viewer\DonorViewerTo pComponent.java:51: warning: [unchecked] unchecked conversion
found : java.util.List
required: java.util.List<donorinfo.Donors>
List<Donors> resultList = query.getResultList();
1 warning
The result of the code is to read data from a database and display the contents in a Jtextarea window. The Jtextarea window generates, but no data is displayed.
Here is the complete code:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.shop.viewer; import donorinfo.Donors; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Persistence; import javax.persistence.Query; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.util.NbBundle.Messages; import org.openide.windows.TopComponent; /** * Top component which displays something. */ @ConvertAsProperties( dtd = "-//org.shop.viewer//DonorViewer//EN", autostore = false) @TopComponent.Description( preferredID = "DonorViewerTopComponent", //iconBase="SET/PATH/TO/ICON/HERE", persistenceType = TopComponent.PERSISTENCE_ALWAYS) @TopComponent.Registration(mode = "explorer", openAtStartup = true) @ActionID(category = "Window", id = "org.shop.viewer.DonorViewerTopComponent") @ActionReference(path = "Menu/Window" /*, position = 333 */) @TopComponent.OpenActionRegistration( displayName = "#CTL_DonorViewerAction", preferredID = "DonorViewerTopComponent") @Messages({ "CTL_DonorViewerAction=DonorViewer", "CTL_DonorViewerTopComponent=DonorViewer Window", "HINT_DonorViewerTopComponent=This is a DonorViewer window" }) public final class DonorViewerTopComponent extends TopComponent { public DonorViewerTopComponent() { initComponents(); setName(Bundle.CTL_DonorViewerTopComponent()); setToolTipText(Bundle.HINT_DonorViewerTopComponent()); EntityManager entityManager = Persistence.createEntityManagerFactory("DonorInfoLibraryPU").createEntityManager(); Query query = entityManager.createNamedQuery("Donors.findAll"); List<Donors> resultList = query.getResultList(); for (Donors c : resultList) { jTextArea1.append(c.getName() + " (" + c.getAmount() + "(" + c.getCharity() +")" + "\n"); } } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane1.setViewportView(jTextArea1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(112, 112, 112) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(122, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(70, 70, 70) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(134, Short.MAX_VALUE)) ); }// </editor-fold> // Variables declaration - do not modify private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextArea1; // End of variables declaration @Override public void componentOpened() { // TODO add custom code on component opening } @Override public void componentClosed() { // TODO add custom code on component closing } void writeProperties(java.util.Properties p) { // better to version settings since initial version as advocated at // [url]http://wiki.apidesign.org/wiki/PropertyFiles[/url] p.setProperty("version", "1.0"); // TODO store your settings } void readProperties(java.util.Properties p) { String version = p.getProperty("version"); // TODO read your settings according to their version } }