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 8321749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:07:56+00:00 2026-06-08T23:07:56+00:00

I don’t knwo whether my desig itself wrong or what. but could any body

  • 0

I don’t knwo whether my desig itself wrong or what. but could any body give me a solution.
I have a Object, PlanningItem. From this i need to get the records form another table by using two properties of PlanningItem. so i created view and and added that view as one to many relation record in PlanningItem. when i was updating the Planning Item i am getting error.
In this i am ready to change view into and subselect or anything else. please suggest the idea to proceed.

Below is my code.

ViewPlannigItem.hbm.xml

<class
        name="com.cotyww.ipmasterdata.core.entity.master.ViewPlannigItem" 
        table="VW_PLANNING_ITEM"  >
        <id name="planningIrc" type="string" column="PLANNING_IRC">
            <generator class="assigned" />
        </id>

        <property name="planningIRCDesc" column="PLANNING_ITEM_DESC"
            type="string" />


        <property name="programId" column="PROGRAM_ID" type="string" />


        <property name="salesOrgId" column="SALES_ORG_ID"
            type="integer" />

        <property name="salesBrandId" column="SALES_BRAND_PKEY"
            type="integer" />

        <many-to-one name="salesBrand" update="false" insert="false"
            class="com.cotyww.ipmasterdata.core.entity.master.SalesBrand"
            column="SALES_BRAND_PKEY" />

        <many-to-one name="salesOrg" update="false" insert="false"
            class="com.cotyww.ipmasterdata.core.entity.master.SalesOrg"
            column="SALES_ORG_ID" />

    </class>

PlanningItem.hbm.xml

<class 
        name="com.cotyww.ipmasterdata.core.entity.master.PlanningItem"
        table="Planning_Item">
        <id name="planningIrc" type="string" column="PLANNING_IRC">
            <generator class="assigned" />
        </id>

        <property name="programId" column="Program_Id" type="string" />

        <property name="planningitemDesc" column="Planning_Item_Desc"
            type="string" />

        <many-to-one name="hierarchyCode" update="false" insert="false"
            class="com.cotyww.ipmasterdata.core.entity.master.GmmBrand"
            column="Gmm_Hierarchy_Code" />

        <property name="gmmhierarchyCode" column="Gmm_Hierarchy_Code"
            type="string" />

        <many-to-one name="gmmcategoryCode" update="false"
            insert="false"
            class="com.cotyww.ipmasterdata.core.entity.master.GmmCategory"
            column="Category_Code" />
        <property name="categoryCode" column="Category_Code"
            type="string" />

        <set name="lstViewPlanningItem"  cascade="none" >
            <key column="PLANNING_IRC" />
            <one-to-many not-found="ignore" 
                class="com.cotyww.ipmasterdata.core.entity.master.ViewPlannigItem" />
            <filter name="planningsalesORg"
                condition="SALES_ORG_ID = :salesOrgId" />
        </set>

        <property name="modifiedBy" column="Audit_User" type="string" />
        <property name="modifiedDate" column="Audit_Date" type="date" />
        <property name="createdBy" column="Created_By" type="string" />
        <property name="createdDate" column="Created_Date" type="date" />

    </class>
    <sql-query name="nextPlanningItemSequenceValueC1US">
        <![CDATA[ SELECT SQ_PLANNING_ITEM_PKEY_C1US.nextVal FROM dual ]]>
    </sql-query>

        <sql-query name="nextPlanningItemSequenceValueC1CA">
        <![CDATA[ SELECT SQ_PLANNING_ITEM_PKEY_C1CA.nextVal FROM dual ]]>
    </sql-query>

        <sql-query name="nextPlanningItemSequenceValueL1US">
        <![CDATA[ SELECT SQ_PLANNING_ITEM_PKEY_L1US.nextVal FROM dual ]]>
    </sql-query>

        <sql-query name="nextPlanningItemSequenceValueL1CA">
        <![CDATA[ SELECT SQ_PLANNING_ITEM_PKEY_L1CA.nextVal FROM dual ]]>
    </sql-query>

        <sql-query name="nextPlanningItemSequenceValueP1US">
        <![CDATA[ SELECT SQ_PLANNING_ITEM_PKEY_P1US.nextVal FROM dual ]]>
    </sql-query>

        <sql-query name="nextPlanningItemSequenceValueP1CA">
        <![CDATA[ SELECT SQ_PLANNING_ITEM_PKEY_P1CA.nextVal FROM dual ]]>
    </sql-query>
    <filter-def name="planningsalesORg">
        <filter-param name="salesOrgId" type="integer" />
    </filter-def>

database View

CREATE OR REPLACE FORCE VIEW COREMASTER.VW_PLANNING_ITEM
(PLANNING_IRC, PLANNING_ITEM_DESC, PROGRAM_ID, SALES_ORG_ID, SALES_BRAND_PKEY, 
 GMM_HIERARCHY_CODE)
AS 
SELECT  P.PLANNING_IRC,
            P.PLANNING_ITEM_DESC,
            P.PROGRAM_ID,
            nvl(MAP.SALES_ORG_ID,MAP1.SALES_ORG_ID) as sales_org,
            nvl(MAP.SALES_BRAND_PKEY,MAP1.SALES_BRAND_PKEY) as sales_brand_pkey,
            P.GMM_HIERARCHY_CODE
     FROM   PLANNING_ITEM P,
            GMM_MAP MAP,
            GMM_MAP MAP1    
     WHERE  
            P.GMM_HIERARCHY_CODE = MAP.GMM_HIERARCHY_CODE(+)
            AND P.CATEGORY_CODE = Map.GMM_CATEGORY_CODE(+)
            AND P.GMM_HIERARCHY_CODE = MAP1.GMM_HIERARCHY_CODE(+)
            AND Map1.GMM_CATEGORY_CODE IS NULL;
  • 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-06-08T23:07:59+00:00Added an answer on June 8, 2026 at 11:07 pm

    Try to set in your one-to-many side of relationship parameter inverse=”true”. This will tell hiberante not to update relationship (FK column) when you are updating parent.

    I mean next:

    <set name="lstViewPlanningItem"  cascade="none"  inverse="true">
             <key column="PLANNING_IRC" />
             <one-to-many not-found="ignore"
                    class="com.cotyww.ipmasterdata.core.entity.master.ViewPlannigItem" />
             <filter name="planningsalesORg"
                    condition="SALES_ORG_ID = :salesOrgId" />
    </set>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't know why but I can't find a solution to this. I have 3
Don't ask me how but I'm in a situation where I have DCPs published
(Don't know if this is strictly on-topic, but I don't see any better Stack
This could be a duplicate question, but I have no idea what search terms
Don't ask why but I have the requirement to draw a border around certain
Don't ask why, but is there any way to suppress a failed linking error?
Don't get me wrong - I love Smalltalk, but... To me, the Squeak interface
Don't know whether I'm having a "thick day" - but I just wondered what
DON'T ASK WHY but... I have a regex that needs to be case insensitive
Don't get me wrong, I want them to get saved. But I always thought

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.