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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:15:48+00:00 2026-05-27T14:15:48+00:00

This code not work correctly: getHibernateTemplate() .find(from elephant.model.Setup s where s.settingName = ?,setupName); Error:

  • 0

This code not work correctly:

getHibernateTemplate()
                .find("from elephant.model.Setup s where s.settingName = ?",setupName);

Error: Position beyond number of declared ordinal parameters. Remember that ordinal parameters are 1-based! Position: 1; nested exception is org.hibernate.QueryParameterException: Position beyond number of declared ordinal parameters. Remember that ordinal parameters are 1-based! Position: 1

If i changed code to:

getHibernateTemplate()
                .find("from elephant.model.Setup s where s.settingName = :setupName",setupName);

I have the same error. How i can solve it ?

later….

i’ll changed query like this:

.find("from elephant.model.Setup s where s.settingName = \"AutoAccessControl\"")

and now we have other error:

2563 [main] WARN org.hibernate.hql.QuerySplitter - no persistent classes found for query class: from elephant.model.Setup s where s.settingName = "AutoAccessControl"

my applicationContext.xml

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

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="jdbc.properties" />
    </bean>

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:/hibernate.cfg.xml" />
        <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            </props>
        </property>
    </bean>

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

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

    <!-- Office -->
    <bean id="OfficeDao" class="elephant.dao.impl.OfficeDao">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="OfficeService" class="elephant.service.impl.OfficeService">
        <property name="dao" ref="OfficeDao" />
    </bean>
    <!-- Office -->
    <!-- XMLFile -->
    <bean id="XMLFileDao" class="elephant.dao.impl.XMLFileDao">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="XMLFileService" class="elephant.service.impl.XMLFileService">
        <property name="dao" ref="XMLFileDao" />
    </bean>
    <!-- XMLFile -->
    <!-- AppointmentCategory -->
    <bean id="AppointmentCategoryDao" class="elephant.dao.impl.AppointmentCategoryDao">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="AppointmentCategoryService" class="elephant.service.impl.AppointmentCategoryService">
        <property name="dao" ref="AppointmentCategoryDao" />
    </bean>
    <!-- AppointmentCategory -->
    <!-- Setup -->
    <bean id="SetupDao" class="elephant.dao.impl.SetupDao">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="SetupService" class="elephant.service.impl.SetupService">
        <property name="dao" ref="SetupDao" />
    </bean>
    <!-- Setup -->
</beans>

my 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.cache.use_second_level_cache">true</property>
        <property name="hibernate.cache.use_query_cache">false</property>
        <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>

        <property name="hibernate.transaction.flush_before_completion">true</property>
        <property name="hibernate.transaction.auto_close_session">true</property>
        <property name="hibernate.hbm2ddl.auto">update</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.format_sql">true</property>
        <property name="hibernate.use_sql_comments">true</property>
        <property name="hibernate.connection.charSet">true</property>

    </session-factory>
</hibernate-configuration>

my jdbc.properties

jdbc.driverClassName=org.postgresql.Driver
jdbc.url=jdbc:postgresql://localhost:5432/hd_test
jdbc.username=musr
jdbc.password=mpwd
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
  • 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-05-27T14:15:50+00:00Added an answer on May 27, 2026 at 2:15 pm

    Are you sure it is this query that is failing – can you try concatenating the value in the query to check.

    The first version should work – the second will not – you will need to use the findByNamedParam.

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

Sidebar

Related Questions

this is my code which will not work correctly ! what is wrong with
The last two lines of this code do not work correctly -- the results
I am unsure why this code will not work. When I click a button
I'm newbie in Python. I can't understand why this code does not work: reOptions
This javascript code does not work in IE8, but works in Firefox and Google
I have this piece of code that does not work: public CartaoCidadao() { InitializeComponent();
How can I do this? (The following code does NOT work, but I hope
Why ItemStyle-VerticalAlign=Middle not work in asp:GridView?, this is my code <asp:GridView ID=GridView1 runat=server RowStyle-VerticalAlign=Middle
Does anyone know why this code doesn't work. This means, the alert is NOT
This piece of code used to work in MVC 1 but it does not

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.