Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7886923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:26:44+00:00 2026-06-03T05:26:44+00:00

Based on the answer from axtavt, this is almost certainly a naming problem between

  • 0

Based on the answer from axtavt, this is almost certainly a naming problem between Notebean and NoteBean. Is there a particular convention to follow here, just normal CamelCase?

I believe that I’ve updated the @NamedQuery annotation in the entity and am using those from the controller, and the names look to match, yet I’m still receiving that same error about the schema, which I can’t get much information on.

JPA controller:

package net.bounceme.dur.nntp.controller;

import java.util.*;
import java.util.logging.Logger;
import javax.mail.Message;
import javax.persistence.*;
import javax.swing.DefaultListModel;
import net.bounceme.dur.nntp.model.NoteBean;

public class NotesController {

    private static final long serialVersionUID = 1L;
    private static final Logger LOG = Logger.getLogger(NotesController.class.getName());
    private Message message;
    private List<NoteBean> notes = new ArrayList<NoteBean>();
    private DefaultListModel defaultListModel = new DefaultListModel();
    private EntityManagerFactory emf;
    private EntityManager em;
    private String PERSISTENCE_UNIT_NAME = "nntpPU";

    public NotesController() {
        emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
        em = emf.createEntityManager();
        LOG.info("entity manager made???" + em.isOpen());
        populateList();
    }

    private void populateList() {
        LOG.info("open?" + em.isOpen());
        em.getTransaction().begin();
        LOG.info("trying to populate.....");
        //Query q = em.createQuery("SELECT n FROM NoteBean n WHERE n.id = :id");
        Query q = em.createNamedQuery("NoteBean.findAll");
        LOG.info(q.toString());
        List results = q.getResultList();
        em.getTransaction().commit();
        setNotes(results);
        DefaultListModel dlm = new DefaultListModel();
        for (NoteBean n : getNotes()) {
            dlm.addElement(n);
        }
        setDefaultListModel(dlm);
    }

    public Message getMessage() {
        return message;
    }

    public void addNote(NoteBean noteBean) {
        LOG.info(noteBean.toString());
        em.getTransaction().begin();
        em.persist(noteBean);
        em.getTransaction().commit();
        populateList();
    }

    public void setMessage(Message message) {
        this.message = message;
    }

    private List<NoteBean> getNotes() {
        return notes;
    }

    private void setNotes(List<NoteBean> notes) {
        this.notes = notes;
    }

    public DefaultListModel getDefaultListModel() {
        return defaultListModel;
    }

    public void setDefaultListModel(DefaultListModel defaultListModel) {
        this.defaultListModel = defaultListModel;
    }
}

entity:

package net.bounceme.dur.nntp.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "NOTEBEAN", catalog = "nntp", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NoteBean.findAll", query = "SELECT n FROM NoteBean n"),
    @NamedQuery(name = "NoteBean.findById", query = "SELECT n FROM Notebean n WHERE n.id = :id"),
    @NamedQuery(name = "NoteBean.findByStamp", query = "SELECT n FROM Notebean n WHERE n.stamp = :stamp"),
    @NamedQuery(name = "NoteBean.findByNote", query = "SELECT n FROM Notebean n WHERE n.note = :note")
})
public class NoteBean implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    private Long id;
    @Column(name = "STAMP")
    @Temporal(TemporalType.DATE)
    private Date stamp;
    @Column(name = "NOTE", length = 255)
    private String note;

    public NoteBean() {
    }

    public NoteBean(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getStamp() {
        return stamp;
    }

    public void setStamp(Date stamp) {
        this.stamp = stamp;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NoteBean)) {
            return false;
        }
        NoteBean other = (NoteBean) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.bounceme.dur.nntp.model.Notebean[ id=" + id + " ]";
    }
}

run-time error:

init:
Deleting: /home/thufir/NetBeansProjects/SwingNNTP/build/built-jar.properties
deps-jar:
Updating property file: /home/thufir/NetBeansProjects/SwingNNTP/build/built-jar.properties
Compiling 2 source files to /home/thufir/NetBeansProjects/SwingNNTP/build/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
Note: /home/thufir/NetBeansProjects/SwingNNTP/src/net/bounceme/dur/nntp/controller/NotesController.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
compile:
run:
May 03, 2012 7:23:05 AM net.bounceme.dur.nntp.PropertiesReader getProps
INFO: NNTP.loadMessages...
May 03, 2012 7:23:06 AM net.bounceme.dur.nntp.controller.MessagesEnum <init>
INFO: starting controller..
[TopLink Info]: 2012.05.03 07:23:10.319--ServerSession(10922033)--TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))
Exception in thread "AWT-EventQueue-0" Local Exception Stack: 
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 [NoteBean.findByNote: SELECT n FROM Notebean n WHERE n.note = :note]. Unknown abstract schema type [Notebean].
    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.SelectNode.getClassOfFirstVariable(SelectNode.java:366)
    at oracle.toplink.essentials.internal.parsing.SelectNode.getReferenceClass(SelectNode.java:354)
    at oracle.toplink.essentials.internal.parsing.ParseTree.getReferenceClass(ParseTree.java:463)
    at oracle.toplink.essentials.internal.parsing.ParseTree.adjustReferenceClassForQuery(ParseTree.java:103)
    at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateReadQueryInternal(EJBQLParseTree.java:127)
    at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateQuery(EJBQLParseTree.java:108)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:219)
    at oracle.toplink.essentials.queryframework.EJBQLPlaceHolderQuery.processEjbQLQuery(EJBQLPlaceHolderQuery.java:111)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.processEJBQLQueries(AbstractSession.java:2059)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.processEJBQLQueries(AbstractSession.java:2046)
    at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:724)
    at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:604)
    at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
    at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
    at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
    at net.bounceme.dur.nntp.controller.NotesController.<init>(NotesController.java:23)
    at net.bounceme.dur.nntp.gui.Detail.<init>(Detail.java:20)
    at net.bounceme.dur.nntp.gui.NewFrame.initComponents(NewFrame.java:30)
    at net.bounceme.dur.nntp.gui.NewFrame.<init>(NewFrame.java:17)
    at net.bounceme.dur.nntp.gui.NewFrame$2.run(NewFrame.java:62)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
    at java.awt.EventQueue.access$000(EventQueue.java:101)
    at java.awt.EventQueue$3.run(EventQueue.java:666)
    at java.awt.EventQueue$3.run(EventQueue.java:664)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
BUILD SUCCESSFUL (total time: 10 seconds)

Just for reference, mysql console output:

mysql> describe nntp.NOTEBEAN;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| ID    | bigint(20)   | NO   | PRI | NULL    |       |
| STAMP | date         | YES  |     | NULL    |       |
| NOTE  | varchar(255) | YES  |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> 
mysql> select * from nntp.NOTEBEAN;
Empty set (0.04 sec)

mysql> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:26:46+00:00Added an answer on June 3, 2026 at 5:26 am

    Name of your entity class (and, thusly, default logical name of the entity for use in queries) is NoteBean, whereas stacktrace complains about Notebean.

    So, you should use NoteBean instead of Notebean in your queries:

    @NamedQuery(name = "Notebean.findById", 
        query = "SELECT n FROM NoteBean n WHERE n.id = :id")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
this question is based on answer got from another SO question, can be found
Based on this answer Get the subdomain from a URL , I am trying
Based the accepted answer to this question I've setup a NetBeans/tomcat environment. In testing
This is a further question based on this answer: How can I implement a
SEE BELOW FOR SOLUTION BASED ON ANSWER/COMMENT from @Bertrand Le Roy ORIGINAL QUESTION: Not
I am trying to create a simple rating controller based on this answer. Rails
Based on my answer to this question , I want to check something on
Based on this answer , I learned of a special class of internal functions
Is there any way to exclude files from an ant fileset based on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.