-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problem querying Set<String> property
PostPosted: Tue Oct 23, 2007 4:01 pm 
Beginner
Beginner

Joined: Mon Apr 24, 2006 9:47 pm
Posts: 33
Location: Kansas City, MO
Hibernate version:
3.2.5ga
Domain Objects:
Code:
package com.nkics.fmc.platform.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

public class User implements java.io.Serializable
{
   protected static final long serialVersionUID = 5769515016671196464L;
   protected Integer id;
   protected String email;
   protected String firstName;
   protected String password;
   protected String lastName;
   protected String nickname;
   protected String title;
   protected String company;
   protected String gcrmId;
   protected Boolean optInFlag;
   protected Boolean approved;
   protected Date created;
   protected Date modified;
   protected Set<UserType> userTypes = new HashSet<UserType>(0);
   protected Set<String> rmmZipCodes = new HashSet<String>(0);
   protected Set<Role> roles = new HashSet<Role>(0);
   protected Set<Crop> consultingCrops = new HashSet<Crop>(0);
   protected Set<ProfessionalDesignation> professionalDesignations = new HashSet<ProfessionalDesignation>(0);
   protected Set<Phone> phones = new HashSet<Phone>(0);
   protected Set<State> consultingStates = new HashSet<State>(0);
   protected Set<Address> addresses = new HashSet<Address>(0);

   // Property accessors
   public Integer getId()
   {
      return this.id;
   }

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

   public String getEmail()
   {
      return this.email;
   }

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

   public String getFirstName()
   {
      return this.firstName;
   }

   public void setFirstName(String userFirstName)
   {
      this.firstName = userFirstName;
   }

   public String getPassword()
   {
      return this.password;
   }

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

   public String getLastName()
   {
      return this.lastName;
   }

   public void setLastName(String userLastName)
   {
      this.lastName = userLastName;
   }

   public String getNickname()
   {
      return this.nickname;
   }

   public void setNickname(String userNickname)
   {
      this.nickname = userNickname;
   }

   public String getTitle()
   {
      return this.title;
   }

   public void setTitle(String userTitle)
   {
      this.title = userTitle;
   }

   public String getCompany()
   {
      return this.company;
   }

   public void setCompany(String userCompany)
   {
      this.company = userCompany;
   }

   public String getGcrmId()
   {
      return this.gcrmId;
   }

   public void setGcrmId(String userGcrmId)
   {
      this.gcrmId = userGcrmId;
   }

   public Boolean getOptInFlag()
   {
      return this.optInFlag;
   }

   public void setOptInFlag(Boolean userOptInFlag)
   {
      this.optInFlag = userOptInFlag;
   }

   public Date getCreated()
   {
      return this.created;
   }

   public void setCreated(Date userCreated)
   {
      this.created = userCreated;
   }

   public Date getModified()
   {
      return this.modified;
   }

   public void setModified(Date userModified)
   {
      this.modified = userModified;
   }

   public Set<Phone> getPhones()
   {
      return this.phones;
   }

   public void setPhones(Set<Phone> phones)
   {
      this.phones = phones;
   }

   public void addPhone(Phone a)
   {
      phones.add(a);
   }

   public void removePhone(Phone a)
   {
      phones.remove(a);
   }

   public Set<Address> getAddresses()
   {
      return this.addresses;
   }

   public void setAddresses(Set<Address> addresses)
   {
      this.addresses = addresses;
   }

   public void addAddress(Address a)
   {
      addresses.add(a);
   }

   public void removeAddress(Address a)
   {
      addresses.remove(a);
   }
   
   /**
    * @return true if 'o' is a reference to this object, or if 'o' is an instance of this object and the hashCode() values are equal.
    */
   public boolean equals(Object o)
   {
      if(this==o) return true; // Referential Equality
      if((o instanceof User)==false) return false; // Type Equality
      return this.hashCode()==o.hashCode();
   }

   /**
    * No two objects will have the same hashCode if their 'id' is not set and equal.
    * @return the hashCode of the 'id' field, or super.hashCode() if 'id' is null.
    */
   public int hashCode()
   {
      if(id!=null) return id.hashCode();
      return super.hashCode();
   }

   public String toString()
   {
      return "User[id="+id+";email="+email+";firstName="+firstName+";password=[PROTECTED];lastName="+lastName+";nickname="+nickname+";title="+title+";company="+company+";gcrmId="+gcrmId+";optInFlag="+optInFlag+";approved="+approved+";created="+created+";modified="+modified+"]";
   }

   public Set<UserType> getUserTypes() {
      return userTypes;
   }

   public void setUserTypes(Set<UserType> userTypes) {
      this.userTypes = userTypes;
   }

   public Set<Role> getRoles() {
      return roles;
   }

   public void setRoles(Set<Role> roles) {
      this.roles = roles;
   }

   public Boolean getApproved()
   {
      return approved;
   }

   public void setApproved(Boolean approved)
   {
      this.approved = approved;
   }

   public Set<Crop> getConsultingCrops()
   {
      return consultingCrops;
   }

   public void setConsultingCrops(Set<Crop> consultingCrops)
   {
      this.consultingCrops = consultingCrops;
   }

   public Set<ProfessionalDesignation> getProfessionalDesignations()
   {
      return professionalDesignations;
   }

   public void setProfessionalDesignations(Set<ProfessionalDesignation> professionalDesignations)
   {
      this.professionalDesignations = professionalDesignations;
   }

   public Set<State> getConsultingStates()
   {
      return consultingStates;
   }

   public void setConsultingStates(Set<State> consultingStates)
   {
      this.consultingStates = consultingStates;
   }

   public Set<String> getRmmZipCodes()
   {
      return rmmZipCodes;
   }

   public void setRmmZipCodes(Set<String> rmmZipCodes)
   {
      this.rmmZipCodes = rmmZipCodes;
   }
}


Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.nkics.fmc.platform.domain">
    <class name="User" table="USERS" dynamic-update="true">
        <id name="id" type="int">
            <column name="USER_ID" />
            <generator class="native" />
        </id>
        <property name="email" type="string">
            <column name="USER_EMAIL" length="200" not-null="true" unique="true" />
        </property>
        <property name="firstName" type="string">
            <column name="USER_FIRST_NAME" length="100" />
        </property>
        <property name="password" type="string">
            <column name="USER_PASSWORD" length="50" not-null="true" />
        </property>
        <property name="lastName" type="string">
            <column name="USER_LAST_NAME" length="100" />
        </property>
        <property name="nickname" type="string">
            <column name="USER_NICKNAME" length="100" />
        </property>
        <property name="title" type="string">
            <column name="USER_TITLE" length="100" />
        </property>
        <property name="company" type="string">
            <column name="USER_COMPANY" length="100" />
        </property>
        <property name="gcrmId" type="string">
            <column name="USER_GCRM_ID" length="11" />
        </property>
        <property name="optInFlag" type="java.lang.Boolean">
            <column name="USER_OPT_IN_FLAG" />
        </property>
        <property name="approved" type="java.lang.Boolean">
            <column name="USER_APPROVED" />
        </property>
        <property name="created" type="timestamp">
            <column name="USER_CREATED" length="23" not-null="true" />
        </property>
        <property name="modified" type="timestamp">
            <column name="USER_MODIFIED" length="23" not-null="true" />
        </property>
        <set name="addresses" cascade="all,delete-orphan">
            <key column="USER_ID" not-null="true" update="false"/>
            <one-to-many class="Address"/>
        </set>
        <set name="consultingCrops" table="CONSULTING_CROP">
            <key column="USER_ID" />
            <many-to-many column="CROP_ID" unique="true" class="Crop" />
        </set>
        <set name="consultingStates" table="CONSULTING_STATE">
            <key column="USER_ID" />
            <many-to-many column="STATE_ID" unique="true" class="State" />
        </set>
        <set name="phones" cascade="all,delete-orphan">
            <key column="USER_ID" not-null="true" update="false"/>
            <one-to-many class="Phone" />
        </set>
        <set name="professionalDesignations" table="USER_PROFESSIONAL_DESIGNATION">
            <key column="USER_ID"/>
            <many-to-many column="PROFESSIONAL_DESIGNATION_ID" unique="true" class="ProfessionalDesignation" />
        </set>
        <set name="roles" table="USER_ROLE">
            <key column="USER_ID" />
            <many-to-many column="ROLE_ID" unique="true" class="Role" />
        </set>
        <set name="userTypes" table="USERS_USER_TYPE">
            <key column="USER_ID" />
            <many-to-many column="USER_TYPE_ID" unique="true" class="UserType" />
        </set>
        <set name="rmmZipCodes" table="RMM_ZIP">
            <key column="USER_ID" />
            <element column="RMM_ZIP_ZIP5" type="string" />
        </set>
    </class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Code:
String zip5 = "64105";
Criteria userCriteria = getSession().createCriteria(User.class);
userCriteria.createCriteria("userTypes").add(Restrictions.eq("key", "RMM"));
userCriteria.add(Restrictions.eq("rmmZipCodes", zip5));
User user = (User)userCriteria.uniqueResult();
return user;

Full stack trace of any exception that occurs:
Code:
2007-10-23 14:48:24,562 WARN [org.hibernate.util.JDBCExceptionReporter] logExceptions - SQL Error: 0, SQLState: 07000
2007-10-23 14:48:24,562 ERROR [org.hibernate.util.JDBCExceptionReporter] logExceptions - Parameter #2 has not been set.
2007-10-23 14:48:24,562 WARN [com.nkics.fmc.exchange.mvc.RmmInfoController] handleRequest - Unable to retrieve RMM information for the current user.
org.hibernate.exception.SQLGrammarException: could not execute query
   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.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
   at com.nkics.fmc.platform.persistence.hibernate.HibernateUserDAO.findRmmByZipCode(HibernateUserDAO.java:93)
   at com.nkics.fmc.platform.service.defaults.DefaultUserService.getRmmUserByZip(DefaultUserService.java:112)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy1.getRmmUserByZip(Unknown Source)
   at com.nkics.fmc.exchange.mvc.RmmInfoController.handleRequest(RmmInfoController.java:68)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:229)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:286)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
   at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Parameter #2 has not been set.
   at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:602)
   at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:692)
   at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
   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)
   ... 60 more


Name and version of the database you are using:
Microsoft SQL Server Desktop Edition 2000

The generated SQL (show_sql=true):
Code:
Hibernate:
    select
        this_.USER_ID as USER1_10_1_,
        this_.USER_EMAIL as USER2_10_1_,
        this_.USER_FIRST_NAME as USER3_10_1_,
        this_.USER_PASSWORD as USER4_10_1_,
        this_.USER_LAST_NAME as USER5_10_1_,
        this_.USER_NICKNAME as USER6_10_1_,
        this_.USER_TITLE as USER7_10_1_,
        this_.USER_COMPANY as USER8_10_1_,
        this_.USER_GCRM_ID as USER9_10_1_,
        this_.USER_OPT_IN_FLAG as USER10_10_1_,
        this_.USER_APPROVED as USER11_10_1_,
        this_.USER_CREATED as USER12_10_1_,
        this_.USER_MODIFIED as USER13_10_1_,
        usertypes3_.USER_ID as USER1_,
        usertype1_.USER_TYPE_ID as USER2_,
        usertype1_.USER_TYPE_ID as USER1_15_0_,
        usertype1_.USER_TYPE_KEY as USER2_15_0_
    from
        USERS this_
    inner join
        USERS_USER_TYPE usertypes3_
            on this_.USER_ID=usertypes3_.USER_ID
    inner join
        USER_TYPE usertype1_
            on usertypes3_.USER_TYPE_ID=usertype1_.USER_TYPE_ID
    where
        usertype1_.USER_TYPE_KEY=?
        and this_.USER_ID=?

Debug level Hibernate log excerpt:
Code:
2007-10-23 15:00:21,171 DEBUG [com.nkics.fmc.platform.service.defaults.DefaultUserService] getRmmUserByZip - Retrieving RMM User assigned to zip code 64105
2007-10-23 15:00:21,171 DEBUG [com.nkics.fmc.platform.persistence.hibernate.HibernateUserDAO] findRmmByZipCode - Looking for RMM User[zip5=64105]
2007-10-23 15:00:21,187 DEBUG [org.hibernate.jdbc.AbstractBatcher] logOpenPreparedStatement - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-10-23 15:00:21,187 DEBUG [org.hibernate.jdbc.AbstractBatcher] logOpenPreparedStatement - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-10-23 15:00:21,187 DEBUG [org.hibernate.SQL] log -
    select
        this_.USER_ID as USER1_10_1_,
        this_.USER_EMAIL as USER2_10_1_,
        this_.USER_FIRST_NAME as USER3_10_1_,
        this_.USER_PASSWORD as USER4_10_1_,
        this_.USER_LAST_NAME as USER5_10_1_,
        this_.USER_NICKNAME as USER6_10_1_,
        this_.USER_TITLE as USER7_10_1_,
        this_.USER_COMPANY as USER8_10_1_,
        this_.USER_GCRM_ID as USER9_10_1_,
        this_.USER_OPT_IN_FLAG as USER10_10_1_,
        this_.USER_APPROVED as USER11_10_1_,
        this_.USER_CREATED as USER12_10_1_,
        this_.USER_MODIFIED as USER13_10_1_,
        usertypes3_.USER_ID as USER1_,
        usertype1_.USER_TYPE_ID as USER2_,
        usertype1_.USER_TYPE_ID as USER1_15_0_,
        usertype1_.USER_TYPE_KEY as USER2_15_0_
    from
        USERS this_
    inner join
        USERS_USER_TYPE usertypes3_
            on this_.USER_ID=usertypes3_.USER_ID
    inner join
        USER_TYPE usertype1_
            on usertypes3_.USER_TYPE_ID=usertype1_.USER_TYPE_ID
    where
        usertype1_.USER_TYPE_KEY=?
        and this_.USER_ID=?
2007-10-23 15:00:21,187 DEBUG [org.hibernate.SQL] log -
    select
        this_.USER_ID as USER1_10_1_,
        this_.USER_EMAIL as USER2_10_1_,
        this_.USER_FIRST_NAME as USER3_10_1_,
        this_.USER_PASSWORD as USER4_10_1_,
        this_.USER_LAST_NAME as USER5_10_1_,
        this_.USER_NICKNAME as USER6_10_1_,
        this_.USER_TITLE as USER7_10_1_,
        this_.USER_COMPANY as USER8_10_1_,
        this_.USER_GCRM_ID as USER9_10_1_,
        this_.USER_OPT_IN_FLAG as USER10_10_1_,
        this_.USER_APPROVED as USER11_10_1_,
        this_.USER_CREATED as USER12_10_1_,
        this_.USER_MODIFIED as USER13_10_1_,
        usertypes3_.USER_ID as USER1_,
        usertype1_.USER_TYPE_ID as USER2_,
        usertype1_.USER_TYPE_ID as USER1_15_0_,
        usertype1_.USER_TYPE_KEY as USER2_15_0_
    from
        USERS this_
    inner join
        USERS_USER_TYPE usertypes3_
            on this_.USER_ID=usertypes3_.USER_ID
    inner join
        USER_TYPE usertype1_
            on usertypes3_.USER_TYPE_ID=usertype1_.USER_TYPE_ID
    where
        usertype1_.USER_TYPE_KEY=?
        and this_.USER_ID=?
Hibernate:
    select
        this_.USER_ID as USER1_10_1_,
        this_.USER_EMAIL as USER2_10_1_,
        this_.USER_FIRST_NAME as USER3_10_1_,
        this_.USER_PASSWORD as USER4_10_1_,
        this_.USER_LAST_NAME as USER5_10_1_,
        this_.USER_NICKNAME as USER6_10_1_,
        this_.USER_TITLE as USER7_10_1_,
        this_.USER_COMPANY as USER8_10_1_,
        this_.USER_GCRM_ID as USER9_10_1_,
        this_.USER_OPT_IN_FLAG as USER10_10_1_,
        this_.USER_APPROVED as USER11_10_1_,
        this_.USER_CREATED as USER12_10_1_,
        this_.USER_MODIFIED as USER13_10_1_,
        usertypes3_.USER_ID as USER1_,
        usertype1_.USER_TYPE_ID as USER2_,
        usertype1_.USER_TYPE_ID as USER1_15_0_,
        usertype1_.USER_TYPE_KEY as USER2_15_0_
    from
        USERS this_
    inner join
        USERS_USER_TYPE usertypes3_
            on this_.USER_ID=usertypes3_.USER_ID
    inner join
        USER_TYPE usertype1_
            on usertypes3_.USER_TYPE_ID=usertype1_.USER_TYPE_ID
    where
        usertype1_.USER_TYPE_KEY=?
        and this_.USER_ID=?
2007-10-23 15:00:21,187 DEBUG [org.hibernate.jdbc.AbstractBatcher] getPreparedStatement - preparing statement
2007-10-23 15:00:21,187 DEBUG [org.hibernate.jdbc.AbstractBatcher] getPreparedStatement - preparing statement
2007-10-23 15:00:21,187 DEBUG [org.hibernate.type.StringType] nullSafeSet - binding 'RMM' to parameter: 1
2007-10-23 15:00:21,187 DEBUG [org.hibernate.type.StringType] nullSafeSet - binding 'RMM' to parameter: 1
2007-10-23 15:00:21,218 DEBUG [org.hibernate.jdbc.AbstractBatcher] logClosePreparedStatement - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2007-10-23 15:00:21,218 DEBUG [org.hibernate.jdbc.AbstractBatcher] logClosePreparedStatement - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2007-10-23 15:00:21,218 DEBUG [org.hibernate.jdbc.AbstractBatcher] closePreparedStatement - closing statement
2007-10-23 15:00:21,218 DEBUG [org.hibernate.jdbc.AbstractBatcher] closePreparedStatement - closing statement
2007-10-23 15:00:21,234 DEBUG [org.hibernate.util.JDBCExceptionReporter] logExceptions - could not execute query [select this_.USER_ID as USER1_10_1_, this_.USER_EMAIL as USER2_10_1_, this_.USER_FIRST_NAME as USER3_10_1_, this_.USER_PASSWORD as USER4_10_1_, this_.USER_LAST_NAME as USER5_10_1_, this_.USER_NICKNAME as USER6_10_1_, this_.USER_TITLE as USER7_10_1_, this_.USER_COMPANY as USER8_10_1_, this_.USER_GCRM_ID as USER9_10_1_, this_.USER_OPT_IN_FLAG as USER10_10_1_, this_.USER_APPROVED as USER11_10_1_, this_.USER_CREATED as USER12_10_1_, this_.USER_MODIFIED as USER13_10_1_, usertypes3_.USER_ID as USER1_, usertype1_.USER_TYPE_ID as USER2_, usertype1_.USER_TYPE_ID as USER1_15_0_, usertype1_.USER_TYPE_KEY as USER2_15_0_ from USERS this_ inner join USERS_USER_TYPE usertypes3_ on this_.USER_ID=usertypes3_.USER_ID inner join USER_TYPE usertype1_ on usertypes3_.USER_TYPE_ID=usertype1_.USER_TYPE_ID where usertype1_.USER_TYPE_KEY=? and this_.USER_ID=?]
java.sql.SQLException: Parameter #2 has not been set.
   at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:602)
   at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:692)
   at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
   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)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
   at org.hibernate.loader.Loader.list(Loader.java:2099)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
   at com.nkics.fmc.platform.persistence.hibernate.HibernateUserDAO.findRmmByZipCode(HibernateUserDAO.java:93)
   at com.nkics.fmc.platform.service.defaults.DefaultUserService.getRmmUserByZip(DefaultUserService.java:112)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy1.getRmmUserByZip(Unknown Source)
   at com.nkics.fmc.exchange.mvc.RmmInfoController.handleRequest(RmmInfoController.java:68)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:229)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:286)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
   at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)
2007-10-23 15:00:21,234 DEBUG [org.hibernate.util.JDBCExceptionReporter] logExceptions - could not execute query [select this_.USER_ID as USER1_10_1_, this_.USER_EMAIL as USER2_10_1_, this_.USER_FIRST_NAME as USER3_10_1_, this_.USER_PASSWORD as USER4_10_1_, this_.USER_LAST_NAME as USER5_10_1_, this_.USER_NICKNAME as USER6_10_1_, this_.USER_TITLE as USER7_10_1_, this_.USER_COMPANY as USER8_10_1_, this_.USER_GCRM_ID as USER9_10_1_, this_.USER_OPT_IN_FLAG as USER10_10_1_, this_.USER_APPROVED as USER11_10_1_, this_.USER_CREATED as USER12_10_1_, this_.USER_MODIFIED as USER13_10_1_, usertypes3_.USER_ID as USER1_, usertype1_.USER_TYPE_ID as USER2_, usertype1_.USER_TYPE_ID as USER1_15_0_, usertype1_.USER_TYPE_KEY as USER2_15_0_ from USERS this_ inner join USERS_USER_TYPE usertypes3_ on this_.USER_ID=usertypes3_.USER_ID inner join USER_TYPE usertype1_ on usertypes3_.USER_TYPE_ID=usertype1_.USER_TYPE_ID where usertype1_.USER_TYPE_KEY=? and this_.USER_ID=?]
java.sql.SQLException: Parameter #2 has not been set.
   at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:602)
   at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:692)
   at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
   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)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
   at org.hibernate.loader.Loader.list(Loader.java:2099)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
   at com.nkics.fmc.platform.persistence.hibernate.HibernateUserDAO.findRmmByZipCode(HibernateUserDAO.java:93)
   at com.nkics.fmc.platform.service.defaults.DefaultUserService.getRmmUserByZip(DefaultUserService.java:112)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy1.getRmmUserByZip(Unknown Source)
   at com.nkics.fmc.exchange.mvc.RmmInfoController.handleRequest(RmmInfoController.java:68)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:229)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:286)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
   at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)
2007-10-23 15:00:21,234 WARN [org.hibernate.util.JDBCExceptionReporter] logExceptions - SQL Error: 0, SQLState: 07000
2007-10-23 15:00:21,234 WARN [org.hibernate.util.JDBCExceptionReporter] logExceptions - SQL Error: 0, SQLState: 07000
2007-10-23 15:00:21,250 ERROR [org.hibernate.util.JDBCExceptionReporter] logExceptions - Parameter #2 has not been set.
2007-10-23 15:00:21,250 ERROR [org.hibernate.util.JDBCExceptionReporter] logExceptions - Parameter #2 has not been set.
2007-10-23 15:00:21,250 DEBUG [org.hibernate.transaction.JDBCTransaction] rollback - rollback
2007-10-23 15:00:21,250 DEBUG [org.hibernate.transaction.JDBCTransaction] rollback - rollback
2007-10-23 15:00:21,265 DEBUG [org.hibernate.transaction.JDBCTransaction] toggleAutoCommit - re-enabling autocommit
2007-10-23 15:00:21,265 DEBUG [org.hibernate.transaction.JDBCTransaction] toggleAutoCommit - re-enabling autocommit
2007-10-23 15:00:21,265 DEBUG [org.hibernate.transaction.JDBCTransaction] rollback - rolled back JDBC Connection
2007-10-23 15:00:21,265 DEBUG [org.hibernate.transaction.JDBCTransaction] rollback - rolled back JDBC Connection
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.JDBCContext] afterTransactionCompletion - after transaction completion
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.JDBCContext] afterTransactionCompletion - after transaction completion
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] afterTransaction - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] afterTransaction - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-10-23 15:00:21,265 DEBUG [org.hibernate.impl.SessionImpl] afterTransactionCompletion - after transaction completion
2007-10-23 15:00:21,265 DEBUG [org.hibernate.impl.SessionImpl] afterTransactionCompletion - after transaction completion
2007-10-23 15:00:21,265 DEBUG [org.hibernate.impl.SessionImpl] close - closing session
2007-10-23 15:00:21,265 DEBUG [org.hibernate.impl.SessionImpl] close - closing session
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] cleanup - performing cleanup
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] cleanup - performing cleanup
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] closeConnection - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] closeConnection - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.JDBCContext] afterTransactionCompletion - after transaction completion
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.JDBCContext] afterTransactionCompletion - after transaction completion
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] afterTransaction - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-10-23 15:00:21,265 DEBUG [org.hibernate.jdbc.ConnectionManager] afterTransaction - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-10-23 15:00:21,265 DEBUG [org.hibernate.impl.SessionImpl] afterTransactionCompletion - after transaction completion
2007-10-23 15:00:21,265 DEBUG [org.hibernate.impl.SessionImpl] afterTransactionCompletion - after transaction completion

Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 25, 2007 5:53 am 
Beginner
Beginner

Joined: Thu May 17, 2007 9:56 am
Posts: 21
Location: India
Hi,

We used give the condition over set using column names. Can you try like that?

(i.e) While giving condition instead of rmmZipCodes you have to give
rmmZipCodes.column name

It works fine to us in our applications..

_________________
Kuzhali


Top
 Profile  
 
 Post subject: workaround
PostPosted: Sun Nov 25, 2007 8:14 pm 
Beginner
Beginner

Joined: Mon Apr 24, 2006 9:47 pm
Posts: 33
Location: Kansas City, MO
I'm not sure I understand.

Could you post sample source code and mapping file(s)?

Thanks for your reply.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.