Hibernate version:
Hibernate 2.1
Mapping documents:
<class
name="ngv.hibernate.NgvLocation"
table="NGV_LOCATION"
>
<composite-id name="comp_id" class="ngv.hibernate.NgvLocationPK">
<key-property
name="warehouseid"
column="WAREHOUSEID"
type="java.lang.String"
length="25"
/>
<key-property
name="locationid"
column="LOCATIONID"
type="java.lang.String"
length="25"
/>
</composite-id>
<property
name="locationconfirmation"
type="java.lang.String"
column="LOCATIONCONFIRMATION"
length="1"
/>
<property
name="confirmationtype"
type="java.lang.String"
column="CONFIRMATIONTYPE"
length="32"
/>
<property
name="locationcoordinatedescr"
type="java.lang.String"
column="LOCATIONCOORDINATEDESCR"
length="64"
/>
<property
name="groupingmask"
type="java.math.BigDecimal"
column="GROUPINGMASK"
length="22"
/>
<property
name="confirmationmask"
type="java.math.BigDecimal"
column="CONFIRMATIONMASK"
length="22"
/>
<property
name="persistencemask"
type="java.math.BigDecimal"
column="PERSISTENCEMASK"
length="22"
/>
<property
name="filler"
type="java.lang.String"
column="FILLER"
length="32"
/>
<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- bi-directional many-to-one association to NgvWarehouse -->
<many-to-one
name="ngvWarehouse"
class="ngv.hibernate.NgvWarehouse"
update="false"
insert="false"
>
<column name="WAREHOUSEID" />
</many-to-one>
<!-- end of derived association(s) -->
<!-- bi-directional one-to-many association to NgvLocationAttribute -->
<set
name="ngvLocationAttributes"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="LOCATIONID" />
<column name="WAREHOUSEID" />
</key>
<one-to-many
class="ngv.hibernate.NgvLocationAttribute"
/>
</set>
<!-- bi-directional one-to-many association to NgvZoneLocation -->
<set
name="ngvZoneLocations"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="LOCATIONID" />
<column name="WAREHOUSEID" />
</key>
<one-to-many
class="ngv.hibernate.NgvZoneLocation"
/>
</set>
<!-- bi-directional one-to-many association to NgvTask -->
<set
name="ngvTasks"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="LOCATIONID" />
<column name="WAREHOUSEID" />
</key>
<one-to-many
class="ngv.hibernate.NgvTask"
/>
</set>
</class>
Code between sessionFactory.openSession() and session.close():
public static String NGV_LOCATION_BY_LOCATIONID =
" FROM com.voxware.orm.NgvLocation " +
" as location WHERE location.comp_id = ? ";
public NgvLocation getNgvLocationByLocationId(String warehouseid,String locationid)
throws HibernateException {
Session session = getSessionFactory().openSession();
NgvLocation location = null;
NgvLocationPK compid = new NgvLocationPK();
compid.setWarehouseid(warehouseid);
compid.setLocationid(locationid);
try {
ArrayList list = new ArrayList();
list = (ArrayList) session.find(
NGV_LOCATION_BY_LOCATIONID,
compid,
Hibernate.entity(NgvLocationPK.class)
);
//if ( (list.isEmpty() || list.size() != 1) ){
if (! list.isEmpty() ){
location = (NgvLocation) list.get(0);
}
} catch (HibernateException he){
he.printStackTrace();
} catch (Exception e){
e.printStackTrace();
} finally {
session.close();
}
return location;
}
Full stack trace of any exception that occurs:
11:07:27,709 INFO [STDOUT] net.sf.hibernate.MappingException: No persister for: com.voxware.orm.NgvLocationPK
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.type.EntityType.toString(EntityType.java:79)
at net.sf.hibernate.impl.Printer.toString(Printer.java:57)
at net.sf.hibernate.engine.QueryParameters.traceParameters(QueryParameters.java:106)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1527)
Name and version of the database you are using:
Oracle 9i
Any help is much appreciated.
Thanks
Krishna
|