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