title: Help I have problem with select query in JPA
body: <p>i have problem i want to </p>
  
  <p>select name_magazine from magazine</p>
  
  <p>and i already import all library needed</p>
  
  <p>and </p>
  
  <blockquote>
    <p>Query q = EntityManger.createQuery ("SELECT name_magazine FROM Magazine");</p>
    
    <p>List results = (List) q.getResultList ();</p>
    
    <p>For(Sting s : result)</p>
    
    <p>System.out.println(s);</p>
  </blockquote>
  
  <p>but when i run this code it's error. can someone help me? Thx</p>
  
  <p>this the error when i run the program</p>
  
  <blockquote>
    <p>Exception in thread "AWT-EventQueue-0"
    java.lang.Error:
    java.lang.reflect.InvocationTargetException
            at org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAction.java:859)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:665)
            at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:698)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
            at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1220)
            at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1261)
            at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
            at java.awt.Component.processMouseEvent(Component.java:6041)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5806)
            at java.awt.Container.processEvent(Container.java:2058)
            at java.awt.Component.dispatchEventImpl(Component.java:4413)
            at java.awt.Container.dispatchEventImpl(Container.java:2116)
            at java.awt.Component.dispatchEvent(Component.java:4243)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
            at java.awt.Container.dispatchEventImpl(Container.java:2102)
            at java.awt.Window.dispatchEventImpl(Window.java:2440)
            at java.awt.Component.dispatchEvent(Component.java:4243)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    Caused by:
    java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:662)
            ... 29 more Caused by: java.lang.IllegalArgumentException: An
    exception occured while creating a
    query in EntityManager
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:209)
            at tugas_rpl.Tugas_RPLView.Iseng(Tugas_RPLView.java:734)
            ... 34 more Caused by: Exception [TOPLINK-8034] (Oracle
    TopLink Essentials - 2.0.1 (Build
    b09d-fcs (12/06/2007))):
    oracle.toplink.essentials.exceptions.EJBQLException
    Exception Description: Error compiling
    the query [Select m.Name from
    magazine m]. Unknown abstract schema type
    [magazine].
            at oracle.toplink.essentials.exceptions.EJBQLException.unknownAbstractSchemaType(EJBQLException.java:494)
            at oracle.toplink.essentials.internal.parsing.ParseTreeContext.classForSchemaName(ParseTreeContext.java:163)
            at oracle.toplink.essentials.internal.parsing.VariableNode.resolveClass(VariableNode.java:280)
            at oracle.toplink.essentials.internal.parsing.DotNode.resolveMapping(DotNode.java:254)
            at oracle.toplink.essentials.internal.parsing.DotNode.endsWithDirectToField(DotNode.java:213)
            at oracle.toplink.essentials.internal.parsing.SelectNode.selectingDirectToField(SelectNode.java:440)
            at oracle.toplink.essentials.internal.parsing.SelectNode.hasOneToOneSelected(SelectNode.java:265)
            at oracle.toplink.essentials.internal.parsing.SelectNode.hasOneToOneSelected(SelectNode.java:222)
            at oracle.toplink.essentials.internal.parsing.SelectGenerationContext.computeUseParallelExpressions(SelectGenerationContext.java:105)
            at oracle.toplink.essentials.internal.parsing.SelectGenerationContext.(SelectGenerationContext.java:88)
            at oracle.toplink.essentials.internal.parsing.ParseTree.buildContextForReadQuery(ParseTree.java:382)
            at oracle.toplink.essentials.internal.parsing.ParseTree.buildContext(ParseTree.java:370)
            at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.buildContext(EJBQLParseTree.java:68)
            at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateQuery(EJBQLParseTree.java:107)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:219)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:189)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:153)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.(EJBQueryImpl.java:114)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.(EJBQueryImpl.java:99)
            at oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.(EJBQueryImpl.java:86)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:204)
            ... 35 more</p>
  </blockquote>
  
  <p>I already try Vincent Ramdhanie,Guðmundur Bjarni suggestion</p>
  
  <blockquote>
    <p>Query q = entityManager.createQuery("Select m.name from magazine m");</p>
    
    <p>List result = (List) q.getResultList();</p>
    
    <p>For(Sting s : result)</p>
    
    <p>System.out.print(s);</p>
  </blockquote>
  
  <p>but still error</p>
  
  <p>this what library &amp; variable i use</p>
  
  <blockquote>
    <p>private javax.persistence.EntityManager entityManager;</p>
    
    <p>import org.jdesktop.application.Action;</p>
    
    <p>import org.jdesktop.application.ResourceMap;</p>
    
    <p>import org.jdesktop.application.SingleFrameApplication;</p>
    
    <p>import org.jdesktop.application.FrameView;</p>
    
    <p>import org.jdesktop.application.TaskMonitor;</p>
    
    <p>import org.jdesktop.application.Task;</p>
    
    <p>import java.awt.event.ActionEvent;</p>
    
    <p>import java.awt.event.ActionListener;</p>
    
    <p>import java.util.ArrayList;</p>
    
    <p>import java.util.List;</p>
    
    <p>import javax.swing.Timer;</p>
    
    <p>import javax.swing.Icon;</p>
    
    <p>import javax.swing.JDialog;</p>
    
    <p>import javax.swing.JFrame;</p>
    
    <p>import javax.swing.event.ListSelectionEvent;</p>
    
    <p>import javax.swing.event.ListSelectionListener;</p>
    
    <p>import org.jdesktop.beansbinding.AbstractBindingListener;</p>
    
    <p>import org.jdesktop.beansbinding.Binding;</p>
    
    <p>import org.jdesktop.beansbinding.PropertyStateEvent;</p>
    
    <p>import javax.persistence.*;</p>
  </blockquote>