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

  • Home
  • SEARCH
  • 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 8793301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:06:19+00:00 2026-06-13T23:06:19+00:00

I am pretty new to Hibernate based Application Developing. Recently i run the same

  • 0

I am pretty new to Hibernate based Application Developing.
Recently i run the same code(which is shown in the below) in Eclipse Juno IDE. It works fine.
But when coming to Netbeans it doesn’t work.And it shows the error as

SEVERE: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘.users users0_ where users0_.uname=’username” at line 1

Here Iam using the Mysql 5.5,IDE-NetBeans-7.2.1.

Here the code i am executing is,

Hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/office manager?zeroDateTimeBehavior=convertToNull</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">root</property>
    <mapping resource="hibernatefiles/Users.hbm.xml"/>
  </session-factory>
</hibernate-configuration>

Hibernating Mapping File:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Nov 6, 2012 12:42:42 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
    <class name="hibernatefiles.Users" table="users" catalog="OFFICE MANAGER">
        <id name="uid" type="java.lang.Integer">
            <column name="Uid" />
            <generator class="identity" />
        </id>
        <property name="uname" type="string">
            <column name="uname" length="50" />
        </property>
        <property name="upass" type="string">
            <column name="upass" length="30" />
        </property>
        <property name="ename" type="string">
            <column name="ename" length="100" />
        </property>
        <property name="edesg" type="string">
            <column name="edesg" length="100" />
        </property>
        <property name="contactnumber" type="java.lang.Integer">
            <column name="contactnumber" />
        </property>
    </class>
</hibernate-mapping>

Users.java(POJO File)

package hibernatefiles;
public class Users  implements java.io.Serializable {


     private Integer uid;
     private String uname;
     private String upass;
     private String ename;
     private String edesg;
     private Integer contactnumber;

    public Users() {
    }

    public Users(String uname, String upass, String ename, String edesg, Integer contactnumber) {
       this.uname = uname;
       this.upass = upass;
       this.ename = ename;
       this.edesg = edesg;
       this.contactnumber = contactnumber;
    }

    public Integer getUid() {
        return this.uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }
    public String getUname() {
        return this.uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }
    public String getUpass() {
        return this.upass;
    }

    public void setUpass(String upass) {
        this.upass = upass;
    }
    public String getEname() {
        return this.ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }
    public String getEdesg() {
        return this.edesg;
    }

    public void setEdesg(String edesg) {
        this.edesg = edesg;
    }
    public Integer getContactnumber() {
        return this.contactnumber;
    }

    public void setContactnumber(Integer contactnumber) {
        this.contactnumber = contactnumber;
    }

}

I am Executing the HQL in the below JSP File by using Query Class.

<%@page import="hibernatefiles.Users"%>
<%@page import="java.util.Iterator"%>
<%@page import="org.hibernate.Query"%>
<%@page import="org.hibernate.Session"%>
<%@page import="org.hibernate.Transaction"%>
<%
    String user_id = request.getParameter("uid");
    String u_pass = request.getParameter("upass");
    out.println("got it dude we get the details..."+user_id+"\n"+u_pass);

    //writing the hibernate code

    Transaction transaction;

    Session ses = hibernatefiles.NewHibernateUtil.getSessionFactory().openSession();
    try{
             transaction = ses.beginTransaction();
             String HQL = "FROM Users u WHERE u.uname='"+user_id+"'";
             Query query = ses.createQuery(HQL);
            java.util.List li = query.list();
            Iterator itera = li.iterator();
            while(itera.hasNext()){
        //getting record
                Users u= (Users) itera.next();
        out.println("user name is:"+u.getUname());
                out.println("user password is :"+u.getUpass());         

            }

    }
    catch(Exception error){
        error.printStackTrace();

    }

%>

Here NetBeans Log

Nov 06, 2012 2:31:27 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/Office_Manager] is completed
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Nov 06, 2012 2:31:45 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : hibernatefiles/Users.hbm.xml
Nov 06, 2012 2:31:46 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Nov 06, 2012 2:31:46 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: hibernatefiles.Users -> users
Nov 06, 2012 2:31:46 PM org.hibernate.cfg.AnnotationConfiguration secondPassCompile
INFO: Hibernate Validator not found: ignoring
Nov 06, 2012 2:31:46 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Nov 06, 2012 2:31:46 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Nov 06, 2012 2:31:46 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Nov 06, 2012 2:31:46 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/office manager?zeroDateTimeBehavior=convertToNull
Nov 06, 2012 2:31:46 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.5.25a
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.18 ( Revision: tonci.grgin@oracle.com-20110930151701-jfj14ddfq48ifkfq )
Nov 06, 2012 2:31:47 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Nov 06, 2012 2:31:47 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Nov 06, 2012 2:31:47 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Nov 06, 2012 2:31:47 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Nov 06, 2012 2:31:47 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Nov 06, 2012 2:31:47 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Nov 06, 2012 2:31:48 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Nov 06, 2012 2:31:48 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 1064, SQLState: 42000
Nov 06, 2012 2:31:48 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.users users0_ where users0_.uname='manikanta'' at line 1
org.hibernate.exception.SQLGrammarException: could not execute query
Hibernate: 
    select
        users0_.Uid as Uid0_,
        users0_.uname as uname0_,
        users0_.upass as upass0_,
        users0_.ename as ename0_,
        users0_.edesg as edesg0_,
        users0_.contactnumber as contactn6_0_ 
    from
        OFFICE MANAGER.users users0_ 
    where
        users0_.uname='manikanta'
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    at org.hibernate.loader.Loader.doList(Loader.java:2223)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
    at org.hibernate.loader.Loader.list(Loader.java:2099)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    at org.apache.jsp.Employers.checking_jsp._jspService(checking_jsp.java:88)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.users users0_ where users0_.uname='manikanta'' at line 1
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2293)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
    at org.hibernate.loader.Loader.doQuery(Loader.java:674)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
    at org.hibernate.loader.Loader.doList(Loader.java:2220)
    ... 33 more
  • 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-13T23:06:19+00:00Added an answer on June 13, 2026 at 11:06 pm

    The problem seems to be in the schema “OFFICE MANAGER”. It has blank space, so it needs to be quoted. Is really “OFFICE MANAGER” the right name? If it is right, then you have to change your hibernate mapping file, to quote the catalog attribute:

    <class name="hibernatefiles.Users" table="users" catalog="`OFFICE MANAGER`">
    

    However, I don’t know why it worked in Eclipse. If you are curious, you could try to run it again in eclipse with <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property> so that is shows the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a web application based on Hibernate, Spring and Wicket. Until now I
I'm pretty new to Eclipse plugins and I want to create a VerticalRuler, I
I am pretty new to python and pyramid. I am working on pyramid application
I'm trying to prototype some pretty simple Hibernate code originating from a tutorial and
I'm pretty new with hibernate, and I'm trying to transform a JDBC project I
I am pretty new to hibernate and I am stuck at this exception. As
I'm pretty new to Hibernate. In my situation I have a concrete table with
I'm pretty new to NHibernate. I have working many to many mappings. they look
Pretty new to MVC and the like. I have a class the looks like
Pretty new to Perl so there may be a very obvious solution here. I'm

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.