Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.1.2
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 15, 2006 8:36:44 PM by Hibernate Tools 3.1.0.beta4 -->
<hibernate-mapping>
<class name="org.ridoc.orm.NamesInmateView" table="NAMES_INMATE_VIEW" schema="DBARI">
<composite-id name="id" class="org.ridoc.orm.NamesInmateViewId">
<key-property name="NLastName" type="string">
<column name="N_LAST_NAME" length="18" />
</key-property>
<key-property name="NFirstName" type="string">
<column name="N_FIRST_NAME" length="15" />
</key-property>
<key-property name="NMinit" type="string">
<column name="N_MINIT" length="1" />
</key-property>
<key-property name="NInmateId" type="integer">
<column name="N_INMATE_ID" precision="7" scale="0" />
</key-property>
<key-property name="NDob" type="date">
<column name="N_DOB" length="7" />
</key-property>
<key-property name="NSsno" type="string">
<column name="N_SSNO" length="9" />
</key-property>
<key-property name="NAka" type="string">
<column name="N_AKA" length="1" />
</key-property>
<key-property name="NSuffix" type="string">
<column name="N_SUFFIX" length="4" />
</key-property>
<key-property name="NStatus" type="string">
<column name="N_STATUS" length="2" />
</key-property>
<key-property name="NIncarcerationNumber" type="java.lang.Integer">
<column name="N_INCARCERATION_NUMBER" precision="7" scale="0" />
</key-property>
<key-property name="ISecurityId" type="string">
<column name="I_SECURITY_ID" length="3" />
</key-property>
<key-property name="IArea" type="string">
<column name="I_AREA" length="8" />
</key-property>
<key-property name="ICellId" type="string">
<column name="I_CELL_ID" length="6" />
</key-property>
<key-property name="IDob" type="date">
<column name="I_DOB" length="7" />
</key-property>
<key-property name="IRace" type="string">
<column name="I_RACE" length="2" />
</key-property>
<key-property name="ISex" type="string">
<column name="I_SEX" length="1" />
</key-property>
<key-property name="IStatus" type="string">
<column name="I_STATUS" length="2" />
</key-property>
<key-property name="IClassCode" type="string">
<column name="I_CLASS_CODE" length="3" />
</key-property>
<key-property name="IPcIndicator" type="string">
<column name="I_PC_INDICATOR" length="1" />
</key-property>
<key-property name="ILastName" type="string">
<column name="I_LAST_NAME" length="18" />
</key-property>
<key-property name="IFirstName" type="string">
<column name="I_FIRST_NAME" length="15" />
</key-property>
<key-property name="IMinit" type="string">
<column name="I_MINIT" length="1" />
</key-property>
<key-property name="ISuffix" type="string">
<column name="I_SUFFIX" length="4" />
</key-property>
<key-property name="IHwobFlag" type="java.lang.Short">
<column name="I_HWOB_FLAG" precision="3" scale="0" />
</key-property>
<key-property name="ICountNames" type="java.lang.Short">
<column name="I_COUNT_NAMES" precision="3" scale="0" />
</key-property>
<key-property name="ILimitCount" type="java.lang.Short">
<column name="I_LIMIT_COUNT" precision="3" scale="0" />
</key-property>
<key-property name="IEnemies" type="java.lang.Short">
<column name="I_ENEMIES" precision="3" scale="0" />
</key-property>
<key-property name="IEnemiesOf" type="java.lang.Short">
<column name="I_ENEMIES_OF" precision="3" scale="0" />
</key-property>
<key-property name="ITotEnemies" type="java.lang.Short">
<column name="I_TOT_ENEMIES" precision="3" scale="0" />
</key-property>
<key-property name="IFpNbr2" type="string">
<column name="I_FP_NBR2" length="10" />
</key-property>
<key-property name="IFpClass1" type="java.lang.Short">
<column name="I_FP_CLASS1" precision="3" scale="0" />
</key-property>
<key-property name="IFpClass2" type="java.lang.Short">
<column name="I_FP_CLASS2" precision="3" scale="0" />
</key-property>
<key-property name="ISmoker" type="string">
<column name="I_SMOKER" length="1" />
</key-property>
<key-property name="IResideWithSmoker" type="string">
<column name="I_RESIDE_WITH_SMOKER" length="1" />
</key-property>
<key-property name="IDatePhotoTaken" type="date">
<column name="I_DATE_PHOTO_TAKEN" length="7" />
</key-property>
<key-property name="ISosCode" type="string">
<column name="I_SOS_CODE" length="2" />
</key-property>
<key-property name="ISosLocation" type="string">
<column name="I_SOS_LOCATION" length="20" />
</key-property>
<key-property name="ISosState" type="string">
<column name="I_SOS_STATE" length="2" />
</key-property>
<key-property name="ISrg" type="string">
<column name="I_SRG" length="1" />
</key-property>
<key-property name="IBinNumber" type="string">
<column name="I_BIN_NUMBER" length="4" />
</key-property>
<key-property name="IIncarcerationNumber" type="java.lang.Integer">
<column name="I_INCARCERATION_NUMBER" precision="7" scale="0" />
</key-property>
<key-property name="VNameField" type="string">
<column name="V_NAME_FIELD" length="25" />
</key-property>
<key-property name="VAliasMesg" type="string">
<column name="V_ALIAS_MESG" length="3" />
</key-property>
<key-property name="VSmoker" type="string">
<column name="V_SMOKER" length="1" />
</key-property>
<key-property name="VBillable" type="string">
<column name="V_BILLABLE" length="28" />
</key-property>
<key-property name="VSrg" type="string">
<column name="V_SRG" length="3" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Using Spring to open and close the session.
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
Hibernate: select namesinmat0_.N_LAST_NAME as N1_204_, namesinmat0_.N_FIRST_NAME as N2_204_, namesinmat0_.N_MINIT as N3_204_, namesinmat0_.N_INMATE_ID as N4_204_, namesinmat0_.N_DOB as N5_204_, namesinmat0_.N_SSNO as N6_204_, namesinmat0_.N_AKA as N7_204_, namesinmat0_.N_SUFFIX as N8_204_, namesinmat0_.N_STATUS as N9_204_, namesinmat0_.N_INCARCERATION_NUMBER as N10_204_, namesinmat0_.I_SECURITY_ID as I11_204_, namesinmat0_.I_AREA as I12_204_, namesinmat0_.I_CELL_ID as I13_204_, namesinmat0_.I_DOB as I14_204_, namesinmat0_.I_RACE as I15_204_, namesinmat0_.I_SEX as I16_204_, namesinmat0_.I_STATUS as I17_204_, namesinmat0_.I_CLASS_CODE as I18_204_, namesinmat0_.I_PC_INDICATOR as I19_204_, namesinmat0_.I_LAST_NAME as I20_204_, namesinmat0_.I_FIRST_NAME as I21_204_, namesinmat0_.I_MINIT as I22_204_, namesinmat0_.I_SUFFIX as I23_204_, namesinmat0_.I_HWOB_FLAG as I24_204_, namesinmat0_.I_COUNT_NAMES as I25_204_, namesinmat0_.I_LIMIT_COUNT as I26_204_, namesinmat0_.I_ENEMIES as I27_204_, namesinmat0_.I_ENEMIES_OF as I28_204_, namesinmat0_.I_TOT_ENEMIES as I29_204_, namesinmat0_.I_FP_NBR2 as I30_204_, namesinmat0_.I_FP_CLASS1 as I31_204_, namesinmat0_.I_FP_CLASS2 as I32_204_, namesinmat0_.I_SMOKER as I33_204_, namesinmat0_.I_RESIDE_WITH_SMOKER as I34_204_, namesinmat0_.I_DATE_PHOTO_TAKEN as I35_204_, namesinmat0_.I_SOS_CODE as I36_204_, namesinmat0_.I_SOS_LOCATION as I37_204_, namesinmat0_.I_SOS_STATE as I38_204_, namesinmat0_.I_SRG as I39_204_, namesinmat0_.I_BIN_NUMBER as I40_204_, namesinmat0_.I_INCARCERATION_NUMBER as I41_204_, namesinmat0_.V_NAME_FIELD as V42_204_, namesinmat0_.V_ALIAS_MESG as V43_204_, namesinmat0_.V_SMOKER as V44_204_, namesinmat0_.V_BILLABLE as V45_204_, namesinmat0_.V_SRG as V46_204_ from DBARI.NAMES_INMATE_VIEW namesinmat0_ where namesinmat0_.N_INMATE_ID>91105 and namesinmat0_.N_INMATE_ID<95999
Debug level Hibernate log excerpt:
????
OK, I used Hibernate tools to gen. my maps. In this case I'm trying to query a view that has two tables in it. What is happening is that it is bringing back a list object. That object looks like it has the correct number of items in it but, all the objects are null!!! At first I thought this had something to do with lazy loading. Therefore I took a number of steps to fix that issue including just setting lazy="false" on all mapping files involved, wrapping the query in a transaction and using the OpenSessionInViewInterceptor AOP interceptor all of which did not work.
The other thing I noticed is that I used Hibernate Tools to gen the maps and it seems that on all the view objects in the database it put all the field of the views into compound keys. I'm not sure why it did this but I'm not planning to doing any data updateing through the views anyway so I don't much care unless this is the cause of my problem.
Has anyone run into this before or could someone offer me some advice on how to correct the problem?
TIA,
-ScottTavares-