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 3673062
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:41:10+00:00 2026-05-19T02:41:10+00:00

org.hibernate.hql.ast.QuerySyntaxException: users is not mapped [SELECT email, id FROM users WHERE email=’dsdd@dds.com’ AND password=’asasas’]

  • 0
org.hibernate.hql.ast.QuerySyntaxException:

users is not mapped [SELECT email, id
FROM users WHERE email=’dsdd@dds.com’
AND password=’asasas’]

public ILogin authenticate(Login login) {
        System.out.println(login);
        System.out.println(login.getEmail());
        String query = "SELECT email, id FROM users WHERE email='"
        + login.getEmail() + "' AND password='" + login.getPassword() + "'";
        results = getHibernateTemplate().find(query);
        System.out.println(results);
        return null;
}

I have a Login Bean class… here it follows.

package 

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

public class Login {
      public Login(){}
        private Long id = null;
        private String email;
        private String password;

        public Login(String email, String password)
        {
            this.email = email;
            this.password = password;
        }

        @Id
        @GeneratedValue(strategy=GenerationType.AUTO)
        public Long getId() {
            return id;
        }

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

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public String getEmail() {
            return email;
        }

        public void setEmail(String email) {
            this.email = email;

        }
}

My application-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" default-autowire="byName" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:p="http://www.springframework.org/schema/p"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="
  http://www.springframework.org/schema/tx 
  http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<!-- Turn on AspectJ @Configurable support -->

<context:spring-configured />
<context:property-placeholder location="classpath*:*.properties" />
<context:component-scan base-package="com.intermedix"/>
<context:annotation-config/>

<!-- Turn on @Autowired, @PostConstruct etc support -->
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" />


<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="myDataSource" />
        <property name="annotatedClasses">
            <list>
                <value>com.intermedix.domain.Login</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">create</prop>
            </props>
        </property>
    </bean>

    <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://127.0.0.1:3306/spring"/>
        <property name="username" value="monty"/>
        <property name="password" value="indian"/>
    </bean>   

    <tx:annotation-driven transaction-manager="txManager"/>

    <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory" />
    </bean>

</beans>
  • 1 1 Answer
  • 2 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-05-19T02:41:11+00:00Added an answer on May 19, 2026 at 2:41 am

    SELECT email, id FROM users

    What is “users”? There is nothing in your config or code called “users”, so Hibernate has no idea what you’re talking about.

    Secondly, your Login class is not annotated with @Entity, so Hibernate is likely ignoring it.

    So add the annotation, and most likely change your query to:

    SELECT email, id FROM Login

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

Sidebar

Related Questions

this is the error org.hibernate.hql.ast.QuerySyntaxException: Payment is not mapped [select p from Payment p]
Im getting following error while running the query. org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found 'LIMIT' near
In hibernate I want to run this JPQL / HQL query: select new org.test.userDTO(
Does somebody knows how to avoid next WARNING for the following code? org.hibernate.hql.internal.ast.HqlSqlWalker [HqlSqlWalker.java:929]
I'm getting this Hibernate error: org.hibernate.MappingException: Could not determine type for: a.b.c.Results$BusinessDate, for columns:
When using hibernate to retrieve data from Oracle 11g DB using either org.hibernate.dialect.Oracle10gDialect or
I'd like to use org.hibernate.tool.hbm2ddl.SchemaExport from hibernate-core 4.1.4 to generate/export a Sybase ASE 15.5
exception javax.servlet.ServletException: org.hibernate.exception.GenericJDBCException: could not execute query org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) root cause
I have a problem with the following HQL query: select sum(MYTABLE.COUNTER) from ( select
I am trying to work with a subquery/sub-select in HQL (Hibernate) but it doesn't

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.