I am performing a simple query agains an Oracle database. Here is the code between session and close
Code:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
List result = session.find("from CatalogEntry_Keyword where KEYWORD_LOWER = ?", key.toLowerCase(), Hibernate.STRING);
tx.commit();
session.close();
This brings me back a nice list of CatalogEntry_Keyword objects. The list is accurate in terms of the number of objects it returns. The trouble is, it returns a list of the same objects (in terms of the retrieved data) rather than unique objects. They seem to be mapped to the first row it finds, then duplicates that data for each row in the query result set. The mapping document for this class is as follows:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.sandboxsystems.lmsextendedAPI.model.CatalogEntry_Keyword" table="LMM.CATALOGENTRY_KEYWORD">
<id name="OID" type="char" column="OID">
<generator class="assigned" />
</id>
<property name="Lang" column="LANG" />
<property name="Keyword_Lower" column="KEYWORD_LOWER" />
<property name="Keyword" column="KEYWORD" />
<property name="CatalogEntry_OID" column="CATALOGENTRY_OID" />
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->