-->
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.  [ 2 posts ] 
Author Message
 Post subject: QBE not working
PostPosted: Sat Mar 18, 2006 3:50 pm 
Newbie

Joined: Sat Mar 18, 2006 3:34 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0
Mapping documents:
Code:
<!DOCTYPE hibernate-mapping
            PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
      <class name="com.ubq.cmngr.dto.SystemAccount" table="SystemAccount">                           
        <id name="account"                            type="string" >
            <generator class="assigned"/>
        </id>           
        <version  name="version" column="version"           type="int"  unsaved-value="negative"/>
        <property name="email"                              type="string" />                           
        <property name="sessionKey"                         type="string" />
               
        <property name="addSource"                          type="string"  update="false"  not-null="true"/>       
        <property name="addDate"                            type="calendar" update="false"  not-null="true"/>
        <property name="updateSource"                       type="string"  not-null="true"/>       
        <property name="updateDate"                         type="calendar"  not-null="true"/>
               
        <property name="config"                               type="string"/>                                   
        <property name="status"                               type="string"/>                                                   
    </class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():
Code:
  public List search(SystemAccount info) throws HibernateException {
        List results = null;
        Session session = createSession();
        try {
            Criteria criteria = session.createCriteria(SystemAccount.class);
            System.out.println(info.getAccount());
            criteria.add(Example.create(info).enableLike().ignoreCase());
            results = criteria.list();
        } catch(HibernateException he) {
            throw he;
        } finally {
            closeSession(session);
        }
        return results;
    }


Name and version of the database you are using:

postgresql 7.3

The generated SQL (show_sql=true):

Code:
select this_.account as account0_, this_.version as version2_0_, this_.email as email2_0_, this_.sessionKey as sessionKey2_0_, this_.addSource as addSource2_0_, this_.addDate as addDate2_0_, this_.updateSource as updateSo7_2_0_, this_.updateDate as updateDate2_0_, this_.config as config2_0_, this_.status as status2_0_ from SystemAccount this_ where (1=1)



It seems the method is pulling back every row....I am only looking for the rows that match the object passed in.............


Kendrick Wilson


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 20, 2006 11:20 pm 
Newbie

Joined: Sat Mar 18, 2006 3:34 pm
Posts: 2
The account number is defined in a super class....and it is not being considered in the query.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.