-->
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.  [ 1 post ] 
Author Message
 Post subject: XML Hibernate Mapping Document bug
PostPosted: Thu Oct 13, 2005 2:09 pm 
Newbie

Joined: Wed Oct 12, 2005 11:17 am
Posts: 7
Hibernate version:
3.0

Mapping documents:
hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration>

<session-factory>
   <property name="myeclipse.connection.profile">Test</property>
   <property name="connection.url">jdbc:oracle:oci:@TEST</property>
   <property name="connection.username">user</property>
   <property name="connection.password">password</property>
   <property name="connection.driver_class">
      oracle.jdbc.driver.OracleDriver
   </property>
   <property name="dialect">
      org.hibernate.dialect.OracleDialect
   </property>
   <property name="show_sql">true</property>
   <!--  c3p0  configuration -->
   <property name="hibernate.connection.provider_class">
      org.hibernate.connection.C3P0ConnectionProvider
   </property>
   <property name="hibernate.c3p0.acquire_increment">3</property>
   <property name="hibernate.c3p0.idle_test_period">3000</property>
   <property name="hibernate.c3p0.min_pool_size">10</property>
   <property name="hibernate.c3p0.max_pool_size">150</property>
   <property name="hibernate.c3p0.max_statements">300</property>
   <property name="hibernate.c3p0.max_idle_time">30</property>

   <mapping resource="schema/InterfaceData.hbm.xml" />
   <mapping resource="schema/InterfaceAudit.hbm.xml" />
   <mapping resource="schema/AcMaster.hbm.xml" />
   <mapping resource="schema/AcTypeSeriesMaster.hbm.xml" />
   <mapping resource="schema/AcActualFlights.hbm.xml" />

</session-factory>

</hibernate-configuration>


InterfaceData.hbm.xml
Code:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration.                   -->
<!-- Created Sat Sep 03 13:35:50 CST 2005                         -->
<hibernate-mapping package="schema">

    <class name="InterfaceData" table="INTERFACE_DATA">
        <composite-id name="id" class="InterfaceDataKey">
            <key-many-to-one name="interfaceAudit" column="TRANSACTION" class="InterfaceAudit"/>
            <key-property name="transactionItem" column="TRANSACTION_ITEM" type="long"/>
        </composite-id>

         <property name="xmlDocument" column="XML_DOCUMENT" type="string" />
        <property name="clobDocument" column="CLOB_DOCUMENT" type="string" />
    </class>
   
</hibernate-mapping>


InterfaceAudit.hbm.xml
Code:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration.                   -->
<!-- Created Sat Sep 03 13:32:47 CST 2005                         -->
<hibernate-mapping package="schema">

    <class name="InterfaceAudit" table="INTERFACE_AUDIT">
        <id name="transaction" column="TRANSACTION" type="long">
            <generator class="assigned"/>
        </id>

        <property name="transactionType" column="TRANSACTION_TYPE" type="string" />
        <property name="transactionObject" column="TRANSACTION_OBJECT" type="string" />
        <property name="transactionMethod" column="TRANSACTION_METHOD" type="string" />
        <property name="transactionDate" column="TRANSACTION_DATE" type="date" />
        <property name="transactionUser" column="TRANSACTION_USER" type="string" />
        <property name="exceptionId" column="EXCEPTION_ID" type="long" />
        <property name="exceptionDetail" column="EXCEPTION_DETAIL" type="string" />
                <property name="exceptionNeedsToBProcessed" column="EXCEPTION_NEEDS_TO_B_PROCESSED" type="string" />
        <property name="exceptionWasProcessed" column="EXCEPTION_WAS_PROCESSED" type="string" />
        <property name="messageNeedsToBeSent" column="MESSAGE_NEEDS_TO_BE_SENT" type="string" />
        <property name="messageWasSent" column="MESSAGE_WAS_SENT" type="string" />
        <property name="messageProcessedBy" column="MESSAGE_PROCESSED_BY" type="string" />
        <property name="messageProcessedDate" column="MESSAGE_PROCESSED_DATE" type="date" />
        <property name="messageExceptionId" column="MESSAGE_EXCEPTION_ID" type="long" />
        <property name="messageExceptionDetail" column="MESSAGE_EXCEPTION_DETAIL" type="string" />
        <property name="exceptionClass" column="EXCEPTION_CLASS" type="string" />
        <property name="exceptionStackTrace" column="EXCEPTION_STACK_TRACE" type="string" />
        <property name="createdBy" column="CREATED_BY" type="string" />
        <property name="createdDate" column="CREATED_DATE" type="date" />
        <property name="modifiedBy" column="MODIFIED_BY" type="string" />
        <property name="modifiedDate" column="MODIFIED_DATE" type="date" />




        <set name="interfaceDataSet" inverse="true">
            <key column="TRANSACTION"/>
            <one-to-many class="InterfaceData"/>
        </set>


    </class>
   
</hibernate-mapping>


AcMaster.hbm.xml
Code:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration.                   -->
<!-- Created Sat Sep 03 13:53:27 CST 2005                         -->
<hibernate-mapping package="schema">

    <class name="AcMaster" table="AC_MASTER">
        <id name="ac" column="AC" type="string">
            <generator class="assigned"/>
        </id>

        <property name="acSn" column="AC_SN" type="string" />
        <property name="overNightStation" column="OVER_NIGHT_STATION" type="string" />
        <property name="acDescription" column="AC_DESCRIPTION" type="string" />
        <property name="acFlightHours" column="AC_FLIGHT_HOURS" type="integer" />
        <property name="acFlightMinutes" column="AC_FLIGHT_MINUTES" type="short" />
        <property name="acBlockHours" column="AC_BLOCK_HOURS" type="integer" />
        <property name="acBlockMinutes" column="AC_BLOCK_MINUTES" type="short" />
        <property name="acCycles" column="AC_CYCLES" type="integer" />
        <property name="acBrakeCycles" column="AC_BRAKE_CYCLES" type="integer" />
        <property name="serviceDate" column="SERVICE_DATE" type="date" />
        <property name="etopsMinutes" column="ETOPS_MINUTES" type="integer" />
        <property name="manufacture" column="MANUFACTURE" type="string" />
        <property name="manufactureDate" column="MANUFACTURE_DATE" type="date" />
        <property name="owner" column="OWNER" type="string" />
        <property name="ownerDate" column="OWNER_DATE" type="date" />
        <property name="operator" column="OPERATOR" type="string" />
        <property name="operatorDate" column="OPERATOR_DATE" type="date" />
        <property name="variableEngineeringNo" column="VARIABLE_ENGINEERING_NO" type="string" />
        <property name="lineNo" column="LINE_NO" type="string" />
        <property name="actualFlightDateControl" column="ACTUAL_FLIGHT_DATE_CONTROL" type="date" />
        <property name="notes" column="NOTES" type="integer" />
        <property name="createdBy" column="CREATED_BY" type="string" />
        <property name="createdDate" column="CREATED_DATE" type="date" />
        <property name="modifiedBy" column="MODIFIED_BY" type="string" />
        <property name="modifiedDate" column="MODIFIED_DATE" type="date" />
        <property name="status" column="STATUS" type="string" />
        <property name="civilAuthority" column="CIVIL_AUTHORITY" type="string" />
        <property name="previousAc" column="PREVIOUS_AC" type="string" />
        <property name="effectivityCode" column="EFFECTIVITY_CODE" type="string" />
        <property name="basicNumber" column="BASIC_NUMBER" type="string" />
        <property name="maxToWeight" column="MAX_TO_WEIGHT" type="integer" />
        <property name="insuranceCompany" column="INSURANCE_COMPANY" type="string" />
        <property name="insuranceCertificate" column="INSURANCE_CERTIFICATE" type="string" />
        <property name="insuranceExpiry" column="INSURANCE_EXPIRY" type="date" />
        <property name="lastDateFlightLogApplied" column="LAST_DATE_FLIGHT_LOG_APPLIED" type="date" />
        <property name="etops" column="ETOPS" type="string" />
        <property name="catRating" column="CAT_RATING" type="string" />
        <property name="configuration1NoSeats" column="CONFIGURATION_1_NO_SEATS" type="integer" />
        <property name="configuration1Code" column="CONFIGURATION_1_CODE" type="string" />
        <property name="configuration2NoSeats" column="CONFIGURATION_2_NO_SEATS" type="integer" />
        <property name="configuration2Code" column="CONFIGURATION_2_CODE" type="string" />
        <property name="configuration3NoSeats" column="CONFIGURATION_3_NO_SEATS" type="integer" />
        <property name="configuration3Code" column="CONFIGURATION_3_CODE" type="string" />
        <property name="configuration4NoSeats" column="CONFIGURATION_4_NO_SEATS" type="integer" />
        <property name="configuration4Code" column="CONFIGURATION_4_CODE" type="string" />
        <property name="range" column="RANGE" type="integer" />
        <property name="flight" column="FLIGHT" type="string" />
        <property name="fopAcType" column="FOP_AC_TYPE" type="string" />
        <property name="fopAcSeries" column="FOP_AC_SERIES" type="string" />
        <property name="acTearDown" column="AC_TEAR_DOWN" type="string" />
        <property name="flightStatus" column="FLIGHT_STATUS" type="string" />
        <property name="acFlightStatus" column="AC_FLIGHT_STATUS" type="string" />
        <property name="acComponentWarrantyHours" column="AC_COMPONENT_WARRANTY_HOURS" type="integer" />
        <property name="acComponentWarrantyCycles" column="AC_COMPONENT_WARRANTY_CYCLES" type="integer" />
        <property name="acComponentWarrantyDays" column="AC_COMPONENT_WARRANTY_DAYS" type="integer" />
        <property name="acComponentWarrantyVendor" column="AC_COMPONENT_WARRANTY_VENDOR" type="string" />
        <property name="acScheduleOutServiceDate" column="AC_SCHEDULE_OUT_SERVICE_DATE" type="date" />
        <property name="acScheduleInServiceDate" column="AC_SCHEDULE_IN_SERVICE_DATE" type="date" />
        <property name="acScheduleOutServiceHour" column="AC_SCHEDULE_OUT_SERVICE_HOUR" type="short" />
        <property name="acScheduleOutServiceMinute" column="AC_SCHEDULE_OUT_SERVICE_MINUTE" type="short" />
        <property name="acScheduleInServiceHour" column="AC_SCHEDULE_IN_SERVICE_HOUR" type="short" />
        <property name="acScheduleInServiceMinute" column="AC_SCHEDULE_IN_SERVICE_MINUTE" type="short" />
        <property name="acOutOfSvrAdvicedDate" column="AC_OUT_OF_SVR_ADVICED_DATE" type="date" />
        <property name="acOutOfSvrAdvicedHour" column="AC_OUT_OF_SVR_ADVICED_HOUR" type="short" />
        <property name="acOutOfSvrAdvicedMinute" column="AC_OUT_OF_SVR_ADVICED_MINUTE" type="short" />
        <property name="acDefectTypeOutService" column="AC_DEFECT_TYPE_OUT_SERVICE" type="string" />
        <property name="acDefectOutOfSerive" column="AC_DEFECT_OUT_OF_SERIVE" type="string" />
        <property name="acDefectItemOutOfService" column="AC_DEFECT_ITEM_OUT_OF_SERVICE" type="short" />
        <property name="acOutOfServiceNotes" column="AC_OUT_OF_SERVICE_NOTES" type="integer" />
        <property name="blobNo" column="BLOB_NO" type="integer" />
        <property name="acPosition" column="AC_POSITION" type="string" />
        <property name="customer" column="CUSTOMER" type="string" />
        <property name="overNightSite" column="OVER_NIGHT_SITE" type="string" />
        <property name="woExpenditureCode" column="WO_EXPENDITURE_CODE" type="string" />
        <property name="woCategory" column="WO_CATEGORY" type="string" />
        <property name="ipc" column="IPC" type="string" />
        <property name="mmEffectivity" column="MM_EFFECTIVITY" type="string" />
        <property name="selcal" column="SELCAL" type="string" />
        <property name="modeS" column="MODE_S" type="string" />
        <property name="lastAcRegistration" column="LAST_AC_REGISTRATION" type="string" />
        <property name="lastAcRegistrationDate" column="LAST_AC_REGISTRATION_DATE" type="date" />
        <property name="lastAcRegistrationChgBy" column="LAST_AC_REGISTRATION_CHG_BY" type="string" />
        <property name="lastAcRegistrationChgOn" column="LAST_AC_REGISTRATION_CHG_ON" type="date" />
        <property name="maxLandingWeight" column="MAX_LANDING_WEIGHT" type="double" />
        <property name="maxLandingWeightUnits" column="MAX_LANDING_WEIGHT_UNITS" type="string" />
        <property name="maxTaxiWeight" column="MAX_TAXI_WEIGHT" type="double" />
        <property name="maxTaxiWeightUnits" column="MAX_TAXI_WEIGHT_UNITS" type="string" />
        <property name="maxZeroFuelWeight" column="MAX_ZERO_FUEL_WEIGHT" type="double" />
        <property name="maxZeroFuelWeightUnits" column="MAX_ZERO_FUEL_WEIGHT_UNITS" type="string" />
        <property name="operatingEmptyWeight" column="OPERATING_EMPTY_WEIGHT" type="double" />
        <property name="operatingEmptyWeightUnits" column="OPERATING_EMPTY_WEIGHT_UNITS" type="string" />
        <property name="fuelCapacity" column="FUEL_CAPACITY" type="double" />
        <property name="fuelCapacityUnits" column="FUEL_CAPACITY_UNITS" type="string" />
        <property name="maxToUnits" column="MAX_TO_UNITS" type="string" />
        <property name="planner" column="PLANNER" type="string" />
        <property name="acSortOrder" column="AC_SORT_ORDER" type="string" />
        <property name="basicEmptyWeightUnits" column="BASIC_EMPTY_WEIGHT_UNITS" type="string" />
        <property name="totalMomentUnits" column="TOTAL_MOMENT_UNITS" type="string" />
        <property name="basicEmptyWeight" column="BASIC_EMPTY_WEIGHT" type="double" />
        <property name="totalMoment" column="TOTAL_MOMENT" type="double" />
        <property name="numberOfSeat1" column="NUMBER_OF_SEAT_1" type="short" />
        <property name="numberOfSeatType1" column="NUMBER_OF_SEAT_TYPE_1" type="string" />
        <property name="numberOfSeat2" column="NUMBER_OF_SEAT_2" type="short" />
        <property name="numberOfSeatType2" column="NUMBER_OF_SEAT_TYPE_2" type="string" />
        <property name="numberOfSeat3" column="NUMBER_OF_SEAT_3" type="short" />
        <property name="numberOfSeatType3" column="NUMBER_OF_SEAT_TYPE_3" type="string" />
        <property name="numberOfSeat4" column="NUMBER_OF_SEAT_4" type="short" />
        <property name="numberOfSeatType4" column="NUMBER_OF_SEAT_TYPE_4" type="string" />
        <property name="rvsm" column="RVSM" type="string" />
        <property name="rvsmFlightLevelStart" column="RVSM_FLIGHT_LEVEL_START" type="short" />
        <property name="rvsmFlightLevelEnd" column="RVSM_FLIGHT_LEVEL_END" type="short" />
        <property name="acPlanningFastUpload" column="AC_PLANNING_FAST_UPLOAD" type="string" />

        <many-to-one name="acTypeSeriesMaster" class="AcTypeSeriesMaster" >
           <column name="AC_TYPE" />
           <column name="AC_SERIES" />
      </many-to-one>

        <set name="acActualFlightsSet" inverse="true">
            <key column="AC"/>
            <one-to-many class="AcActualFlights"/>
        </set>

    </class>
   
</hibernate-mapping>


AcTypeSeriesMaster.hbm.xml
Code:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration.                   -->
<!-- Created Sat Sep 03 13:53:27 CST 2005                         -->
<hibernate-mapping package="schema">

    <class name="AcTypeSeriesMaster" table="AC_TYPE_SERIES_MASTER">
        <composite-id name="id" class="AcTypeSeriesMasterKey">
            <key-property name="acSeries" column="AC_SERIES" type="string"/>
            <key-property name="acType" column="AC_TYPE" type="string"/>
        </composite-id>

        <property name="acTypeSeriesDescription" column="AC_TYPE_SERIES_DESCRIPTION" type="string" />
        <property name="numberOfEngine" column="NUMBER_OF_ENGINE" type="short" />
        <property name="notes" column="NOTES" type="integer" />
        <property name="createdBy" column="CREATED_BY" type="string" />
        <property name="createdDate" column="CREATED_DATE" type="date" />
        <property name="modifiedBy" column="MODIFIED_BY" type="string" />
        <property name="modifiedDate" column="MODIFIED_DATE" type="date" />
        <property name="aft" column="AFT" type="float" />
        <property name="bft" column="BFT" type="float" />
        <property name="configuration1NoSeats" column="CONFIGURATION_1_NO_SEATS" type="integer" />
        <property name="configuration1Code" column="CONFIGURATION_1_CODE" type="string" />
        <property name="configuration2NoSeats" column="CONFIGURATION_2_NO_SEATS" type="integer" />
        <property name="configuration2Code" column="CONFIGURATION_2_CODE" type="string" />
        <property name="configuration3NoSeats" column="CONFIGURATION_3_NO_SEATS" type="integer" />
        <property name="configuration3Code" column="CONFIGURATION_3_CODE" type="string" />
        <property name="configuration4NoSeats" column="CONFIGURATION_4_NO_SEATS" type="integer" />
        <property name="configuration4Code" column="CONFIGURATION_4_CODE" type="string" />
        <property name="flightUse" column="FLIGHT_USE" type="string" />



    </class>
   
</hibernate-mapping>


AcActualFlights.hbm.xml
Code:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration.                   -->
<!-- Created Sat Sep 03 13:52:19 CST 2005                         -->
<hibernate-mapping package="schema">

    <class name="AcActualFlights" table="AC_ACTUAL_FLIGHTS">
        <composite-id name="id" class="AcActualFlightsKey">
           <key-many-to-one name="acMaster" column="AC" class="AcMaster"/>           
            <key-property name="createdDate" column="CREATED_DATE" type="date"/>
            <key-property name="flightLeg" column="FLIGHT_LEG" type="short"/>
            <key-property name="flightLog" column="FLIGHT_LOG" type="string"/>
        </composite-id>

        <property name="flightDate" column="FLIGHT_DATE" type="date" />
        <property name="origin" column="ORIGIN" type="string" />
        <property name="destination" column="DESTINATION" type="string" />
        <property name="flight" column="FLIGHT" type="string" />
        <property name="status" column="STATUS" type="string" />
        <property name="offHour" column="OFF_HOUR" type="short" />
        <property name="offMinute" column="OFF_MINUTE" type="short" />
        <property name="toHour" column="TO_HOUR" type="short" />
        <property name="toMinute" column="TO_MINUTE" type="short" />
        <property name="ldgHour" column="LDG_HOUR" type="short" />
        <property name="ldgMinute" column="LDG_MINUTE" type="short" />
        <property name="onHour" column="ON_HOUR" type="short" />
        <property name="onMinute" column="ON_MINUTE" type="short" />
        <property name="flightHours" column="FLIGHT_HOURS" type="integer" />
        <property name="flightMinutes" column="FLIGHT_MINUTES" type="short" />
        <property name="cycles" column="CYCLES" type="integer" />
        <property name="blockHours" column="BLOCK_HOURS" type="integer" />
        <property name="blockMinutes" column="BLOCK_MINUTES" type="short" />
        <property name="totalAcFlightHours" column="TOTAL_AC_FLIGHT_HOURS" type="integer" />
        <property name="totalAcFlightMinutes" column="TOTAL_AC_FLIGHT_MINUTES" type="short" />
        <property name="totalAcCycles" column="TOTAL_AC_CYCLES" type="integer" />
        <property name="totalAcBrakeCycles" column="TOTAL_AC_BRAKE_CYCLES" type="integer" />
        <property name="totalAcBlockHours" column="TOTAL_AC_BLOCK_HOURS" type="integer" />
        <property name="totalAcBlockMinutes" column="TOTAL_AC_BLOCK_MINUTES" type="short" />
        <property name="flightCategory" column="FLIGHT_CATEGORY" type="string" />
        <property name="fuelBurned" column="FUEL_BURNED" type="integer" />
        <property name="notes" column="NOTES" type="integer" />
        <property name="createdBy" column="CREATED_BY" type="string" />
        <property name="modifiedBy" column="MODIFIED_BY" type="string" />
        <property name="modifiedDate" column="MODIFIED_DATE" type="date" />
        <property name="acVoid" column="VOID" type="string" />
        <property name="pilotFlightHours" column="PILOT_FLIGHT_HOURS" type="integer" />
        <property name="pilotFlightMinutes" column="PILOT_FLIGHT_MINUTES" type="short" />
        <property name="updateMode" column="UPDATE_MODE" type="string" />
        <property name="blobNo" column="BLOB_NO" type="integer" />
        <property name="etopsFlight" column="ETOPS_FLIGHT" type="string" />
        <property name="acMaintenanceReset" column="AC_MAINTENANCE_RESET" type="string" />
        <property name="pilotCycles" column="PILOT_CYCLES" type="integer" />
        <property name="catRating" column="CAT_RATING" type="string" />
        <property name="maintenanceLog" column="MAINTENANCE_LOG" type="string" />
        <property name="flightHoursAtClosing" column="FLIGHT_HOURS_AT_CLOSING" type="integer" />
        <property name="flightMinutesAtClosing" column="FLIGHT_MINUTES_AT_CLOSING" type="short" />
        <property name="cyclesAtClosing" column="CYCLES_AT_CLOSING" type="integer" />
        <property name="catType" column="CAT_TYPE" type="string" />
        <property name="catResult" column="CAT_RESULT" type="string" />
    </class>
   
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
      Transaction tx = session.beginTransaction();
      
      java.util.Date myDate = new java.util.Date();
      System.out.println(myDate);
      
      // Create composite key
      AcActualFlightsKey key = new AcActualFlightsKey();
      key.setAcMaster( new AcMaster( "N525MC"));
      key.setFlightLog( "TEST56789012" );
      key.setFlightLeg( new Short( (short)1) );
      key.setCreatedDate( myDate );
      
      // Create new object
      AcActualFlights flight = new AcActualFlights();
      
      flight.setId(key);
      flight.setFlightDate(myDate);
      
      // persist object in DB
      session.save(flight);
      tx.commit();
      HibernateSessionFactory.closeSession();
      session = null;
      tx = null;
      flight = null;
      
      // retrieve object just created
      session = HibernateSessionFactory.currentSession();
      tx = session.beginTransaction();
      
      flight = (AcActualFlights) session.get(AcActualFlights.class, key);
      
      String myFlightNumber = flight.getFlight();
      
      // Display retrieved value
      System.out.println("Flight Number: " + myFlightNumber);
      
      //Delete object
      session.delete(flight);
      
      tx.commit();


Name and version of the database you are using:
Oracle 9.2 or Oracle 10 server with Oracle 10 client.

The generated SQL (show_sql=true):
Code:
Hibernate: insert into AC_ACTUAL_FLIGHTS (FLIGHT_DATE, ORIGIN, DESTINATION, FLIGHT, STATUS, OFF_HOUR, OFF_MINUTE, TO_HOUR, TO_MINUTE, LDG_HOUR, LDG_MINUTE, ON_HOUR, ON_MINUTE, FLIGHT_HOURS, FLIGHT_MINUTES, CYCLES, BLOCK_HOURS, BLOCK_MINUTES, TOTAL_AC_FLIGHT_HOURS, TOTAL_AC_FLIGHT_MINUTES, TOTAL_AC_CYCLES, TOTAL_AC_BRAKE_CYCLES, TOTAL_AC_BLOCK_HOURS, TOTAL_AC_BLOCK_MINUTES, FLIGHT_CATEGORY, FUEL_BURNED, NOTES, CREATED_BY, MODIFIED_BY, MODIFIED_DATE, VOID, PILOT_FLIGHT_HOURS, PILOT_FLIGHT_MINUTES, UPDATE_MODE, BLOB_NO, ETOPS_FLIGHT, AC_MAINTENANCE_RESET, PILOT_CYCLES, CAT_RATING, MAINTENANCE_LOG, FLIGHT_HOURS_AT_CLOSING, FLIGHT_MINUTES_AT_CLOSING, CYCLES_AT_CLOSING, CAT_TYPE, CAT_RESULT, AC, CREATED_DATE, FLIGHT_LEG, FLIGHT_LOG) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: select acactualfl0_.AC as AC0_, acactualfl0_.CREATED_DATE as CREATED2_0_, acactualfl0_.FLIGHT_LEG as FLIGHT3_0_, acactualfl0_.FLIGHT_LOG as FLIGHT4_0_, acactualfl0_.FLIGHT_DATE as FLIGHT5_4_0_, acactualfl0_.ORIGIN as ORIGIN4_0_, acactualfl0_.DESTINATION as DESTINAT7_4_0_, acactualfl0_.STATUS as STATUS4_0_, acactualfl0_.OFF_HOUR as OFF10_4_0_, acactualfl0_.OFF_MINUTE as OFF11_4_0_, acactualfl0_.TO_HOUR as TO12_4_0_, acactualfl0_.TO_MINUTE as TO13_4_0_, acactualfl0_.LDG_HOUR as LDG14_4_0_, acactualfl0_.LDG_MINUTE as LDG15_4_0_, acactualfl0_.ON_HOUR as ON16_4_0_, acactualfl0_.ON_MINUTE as ON17_4_0_, acactualfl0_.FLIGHT_HOURS as FLIGHT18_4_0_, acactualfl0_.FLIGHT_MINUTES as FLIGHT19_4_0_, acactualfl0_.CYCLES as CYCLES4_0_, acactualfl0_.BLOCK_HOURS as BLOCK21_4_0_, acactualfl0_.BLOCK_MINUTES as BLOCK22_4_0_, acactualfl0_.TOTAL_AC_FLIGHT_HOURS as TOTAL23_4_0_, acactualfl0_.TOTAL_AC_FLIGHT_MINUTES as TOTAL24_4_0_, acactualfl0_.TOTAL_AC_CYCLES as TOTAL25_4_0_, acactualfl0_.TOTAL_AC_BRAKE_CYCLES as TOTAL26_4_0_, acactualfl0_.TOTAL_AC_BLOCK_HOURS as TOTAL27_4_0_, acactualfl0_.TOTAL_AC_BLOCK_MINUTES as TOTAL28_4_0_, acactualfl0_.FLIGHT_CATEGORY as FLIGHT29_4_0_, acactualfl0_.FUEL_BURNED as FUEL30_4_0_, acactualfl0_.NOTES as NOTES4_0_, acactualfl0_.CREATED_BY as CREATED32_4_0_, acactualfl0_.MODIFIED_BY as MODIFIED33_4_0_, acactualfl0_.MODIFIED_DATE as MODIFIED34_4_0_, acactualfl0_.VOID as VOID4_0_, acactualfl0_.PILOT_FLIGHT_HOURS as PILOT36_4_0_, acactualfl0_.PILOT_FLIGHT_MINUTES as PILOT37_4_0_, acactualfl0_.UPDATE_MODE as UPDATE38_4_0_, acactualfl0_.BLOB_NO as BLOB39_4_0_, acactualfl0_.ETOPS_FLIGHT as ETOPS40_4_0_, acactualfl0_.AC_MAINTENANCE_RESET as AC41_4_0_, acactualfl0_.PILOT_CYCLES as PILOT42_4_0_, acactualfl0_.CAT_RATING as CAT43_4_0_, acactualfl0_.MAINTENANCE_LOG as MAINTEN44_4_0_, acactualfl0_.FLIGHT_HOURS_AT_CLOSING as FLIGHT45_4_0_, acactualfl0_.FLIGHT_MINUTES_AT_CLOSING as FLIGHT46_4_0_, acactualfl0_.CYCLES_AT_CLOSING as CYCLES47_4_0_, acactualfl0_.CAT_TYPE as CAT48_4_0_, acactualfl0_.CAT_RESULT as CAT49_4_0_ from AC_ACTUAL_FLIGHTS acactualfl0_ where acactualfl0_.AC=? and acactualfl0_.CREATED_DATE=? and acactualfl0_.FLIGHT_LEG=? and acactualfl0_.FLIGHT_LOG=?
Hibernate: delete from AC_ACTUAL_FLIGHTS where AC=? and CREATED_DATE=? and FLIGHT_LEG=? and FLIGHT_LOG=?


When I call this
Code:
String myFlightNumber = flight.getFlight();

I sometimes get a (incorrect) value if the data is actually null in the database. This value will change depending upon which order I place items in my hibernate.cfg.xml file. This doesn't seem right to me. I looked at the documentation and didn't see anything about the how the elements should be sequenced. Am I missing something?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.