Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6210833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:13:52+00:00 2026-05-24T06:13:52+00:00

I am working with an Oracle legacy database and I am trying to map

  • 0

I am working with an Oracle legacy database and I am trying to map a relationship with two tables. Unfortunately the company who designed the database used composite keys.

I’ve got this table (ORDERS) which has a primary key composed on 3 fields: ordernumber (number), version and company.

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="BpSalesOrders.Domain"
                   namespace="BpSalesOrders.Domain">
  <class name="Order" table="OCSAORH" mutable="false" where="OCHAMND = 0">
    <cache usage="read-only"/>
    <composite-id>
      <key-property name="Number" column="OCHORDN" type="String" length="10"></key-property>
      <key-property name="Ver" column="OCHAMND" type="Int32"></key-property>
      <key-property name="Company" column="OCHCOSC" type="String" length="5"></key-property>
    </composite-id>
    <property name="Reference" column="OCHOCNO" type="String" length="25"></property>
    <property name="Date" column="OCHOCDT" type="Int32"></property>
    <property name="Status" column="OCHSTA1" type="Char"></property>
    <property name="LineOfCreditStatus" column="OCHSTA4" type="Char"></property>
    <property name="WareHouse" column="OCHRESP" type="String"></property>
    <set name="OrderLines" access="field.pascalcase-underscore" inverse="true" lazy="true" mutable="false">
      <key>
        <column name="OCLORDN" not-null="true"/>
        <column name="OCLAMND" not-null="true" default="0"/>
        <column name="OCLCOSC" not-null="true"/>
      </key>
      <one-to-many class="OrderLine" not-found ="ignore"/>
    </set>
    <set name="OrderReleases" access="field.pascalcase-underscore" inverse="true" lazy="true" mutable="false">
      <key>
        <column name="ORLORDINE" not-null="true" />
        <column name="ORLSOCIETA" not-null="true"/>
      </key>
      <one-to-many class="OrderRelease" not-found ="ignore"/>
    </set>
  </class>
</hibernate-mapping>

There’s a relation with OrderLines which works fine cause that table has the same exact key structure.
I am having problem with the OrderReleases relation. That table has got a primary key composed on a OrderNumber, Company and date. There’s no version here:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                     assembly="BpSalesOrders.Domain"
                     namespace="BpSalesOrders.Domain">
  <class name="OrderRelease" table="OCBPORDRIL" mutable="true">
    <composite-id>
      <key-property name="Company" column="ORLSOCIETA" type ="String" length="5"></key-property>
      <key-property name="OrderNumber" column="ORLORDINE" type ="String" length="10"></key-property>
      <key-property name="RequestDate" column="ORLDATARICHIESTA" type ="Int32"></key-property>
    </composite-id>
    <property name="Status" column="ORLSTATUS" type="Char" length="1"></property>
    <property name="StatusMessage" column="ORLSEGNALAZIONE" type="String" length="90"></property>
    <property name="ProcessingDate" column="ORLDATAELABORA" type ="Int32"></property>
  </class>
</hibernate-mapping>

Considering that the relationship is one-to-many I would like to join the table Orders and OrderRelease on OrderNumber and Company. If I try to do that (as in the example) nHibernate throws an exception telling me that the key it’s trying to map is composed with 3 fields.

Is there a way to create an non-existing column which wouldn’t be persisted so that I can setup my mapping and relations?

Any help will be apreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:13:53+00:00Added an answer on May 24, 2026 at 6:13 am

    Ended up creating a view with a fake column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a legacy database in Oracle and some of my tables have
I'm working with an Oracle DB, and I'm trying to map this class: public
I am a .Net web developer working with a legacy Oracle database. In the
Im working on a legacy oracle database with a slightly odd table naming convention
i am working on a legacy oracle database that uses character literals T and
I am working with an oracle legacy database. All the dates are saved in
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
We are working with an oracle database in which the person that set it
I am working with a oracle database and Jython. I can get data pulled
When working with tables in Oracle, how do you know when you are setting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.