facebook

Problem with # of foreign columns <> to primary key co

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #228185 Reply

    ketaj27
    Member

    Hello,

    I’m running into the following issue with a Foreign Key Mapping. Any help would be greatly appreciated….

    Error Message:
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.RbacSubscribedUsers
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.Requests
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.ApplicationPortfolio
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.SourceKeyTranslationTypes
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.SourceKeyTranslationTypes
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.SourceKeyTranslationTypes
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.HierarchyTypes
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.SourceKeyTranslationTypes
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.ApplicationAssignment
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.ApplicationRoleAssignment
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.RbacSubscribedUsers
    2994 [main] DEBUG net.sf.hibernate.cfg.Configuration – resolving reference to class: com.kraft.rbac.domain.HierarchyTreeDetail
    3004 [main] ERROR com.kraft.rbac.HibernateUtil – Initial SessionFactory creation failed.
    net.sf.hibernate.MappingException: Foreign key (RESPONSIBILITY_ASSIGNMENT [HIERARCHY_NODE_CD])) must have same number of columns as the referenced primary key (HIERARCHY_TREE_DETAIL [HIERARCHY_NODE_CD,HIERARCHY_TREE_CD])

    at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:67)
    at net.sf.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:696)
    at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:671)
    at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789)
    at com.kraft.rbac.HibernateUtil.<clinit>(HibernateUtil.java:18)
    at com.kraft.rbac.dal.RequestDAL.saveRequest(RequestDAL.java:89)
    at com.kraft.rbac.test.RequestDALTest.testSaveRequest(RequestDALTest.java:93)
    at java.lang.reflect.Method.invoke(Native Method)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)

    Here’s additional information:

    SQL to create Hierarchy table:

    CREATE TABLE HIERARCHY_TREE_DETAIL (
    HIERARCHY_NODE_CD INTEGER NOT NULL,
    HIERARCHY_NODE_PAR_CD INTEGER,
    NODE_NAME VARCHAR2 (50),
    ACTIVATION_DATE DATE,
    DEACTIVATION_DATE DATE,
    CREATED_TS DATE,
    CREATED_BY VARCHAR2 (20),
    MODIFIED_TS DATE,
    MODIFIED_BY VARCHAR2 (20),
    HIERARCHY_TREE_CD INTEGER NOT NULL,
    LEVEL_CD INTEGER,
    HAS_DEPENDENT_IND CHAR (1),
    SOURCE_KEY_1 VARCHAR2 (30),
    SOURCE_KEY_2 VARCHAR2 (30),
    SOURCE_KEY_3 VARCHAR2 (30),
    SOURCE_KEY_4 VARCHAR2 (30),
    PRIMARY KEY ( HIERARCHY_NODE_CD, HIERARCHY_TREE_CD )
    USING INDEX );

    ALTER TABLE HIERARCHY_TREE_DETAIL ADD
    FOREIGN KEY (HIERARCHY_NODE_CD, HIERARCHY_TREE_CD)
    REFERENCES HIERARCHY_TREE_DETAIL (HIERARCHY_NODE_CD, HIERARCHY_TREE_CD) ON DELETE SET NULL;

    ALTER TABLE HIERARCHY_TREE_DETAIL ADD
    FOREIGN KEY (HIERARCHY_TREE_CD)
    REFERENCES HIERARCHY_TREES (HIERARCHY_TREE_CD) ;

    SQL to create Responsibility table:
    CREATE TABLE RESPONSIBILITY_ASSIGNMENT (
    RESPONSIBILITY_ASSIGNMENT_ID VARCHAR2 (20) NOT NULL,
    GLOBAL_ID VARCHAR2 (20),
    ACTIVATION_DATE DATE,
    DEACTIVATION_DATE DATE,
    ACTIVE_FLG CHAR (1),
    FINAL_REACTIVATION_DATE DATE,
    ADD_REQUEST_ID VARCHAR2 (20) NOT NULL,
    APPLICATION_ROLE_ASSIGNMENT_ID VARCHAR2 (20) NOT NULL,
    HIERARCHY_NODE_CD INTEGER NOT NULL,
    HIERARCHY_TREE_CD INTEGER NOT NULL,
    PRIMARY KEY ( RESPONSIBILITY_ASSIGNMENT_ID )
    USING INDEX );

    ALTER TABLE RESPONSIBILITY_ASSIGNMENT ADD
    FOREIGN KEY (HIERARCHY_NODE_CD, HIERARCHY_TREE_CD)
    REFERENCES HIERARCHY_TREE_DETAIL (HIERARCHY_NODE_CD, HIERARCHY_TREE_CD) ;

    ALTER TABLE RESPONSIBILITY_ASSIGNMENT ADD
    FOREIGN KEY (APPLICATION_ROLE_ASSIGNMENT_ID)
    REFERENCES APPLICATION_ROLE_ASSIGNMENT (APPLICATION_ROLE_ASSIGNMENT_ID) ;

    ALTER TABLE RESPONSIBILITY_ASSIGNMENT ADD
    FOREIGN KEY (ADD_REQUEST_ID)
    REFERENCES REQUESTS (REQUEST_ID) ;

    ALTER TABLE RESPONSIBILITY_ASSIGNMENT ADD
    FOREIGN KEY (GLOBAL_ID)
    REFERENCES RBAC_SUBSCRIBED_USERS (GLOBAL_ID) ON DELETE SET NULL;

    Code generated by MyEclipse:

    AbstractHierarchyTreeDetail

    /*
    * WARNING: DO NOT EDIT THIS FILE. This is a generated file that is synchronized
    * by MyEclipse Hibernate tool integration.
    *
    * Created Fri Apr 15 13:07:54 CDT 2005 by MyEclipse Hibernate Tool.
    */
    package com.kraft.rbac.domain;

    import java.io.Serializable;

    /**
    * A class that represents a row in the HIERARCHY_TREE_DETAIL table.
    * You can customize the behavior of this class by editing the class, {@link HierarchyTreeDetail()}.
    * WARNING: DO NOT EDIT THIS FILE. This is a generated file that is synchronized * by MyEclipse Hibernate tool integration.
    */
    public abstract class AbstractHierarchyTreeDetail
    implements Serializable
    {
    /** The cached hash code value for this instance. Settting to 0 triggers re-calculation. */
    private int hashValue = 0;

    /** The simple primary key value. */
    private HierarchyTreeDetailKey id;

    /** The value of the simple hierarchyNodeParCd property. */
    private java.lang.Long hierarchyNodeParCd;

    /** The value of the simple nodeName property. */
    private java.lang.String nodeName;

    /** The value of the simple activationDate property. */
    private java.util.Date activationDate;

    /** The value of the simple deactivationDate property. */
    private java.util.Date deactivationDate;

    /** The value of the simple createdTs property. */
    private java.util.Date createdTs;

    /** The value of the simple createdBy property. */
    private java.lang.String createdBy;

    /** The value of the simple modifiedTs property. */
    private java.util.Date modifiedTs;

    /** The value of the simple modifiedBy property. */
    private java.lang.String modifiedBy;

    /** The value of the simple levelCd property. */
    private java.lang.Long levelCd;

    /** The value of the simple hasDependentInd property. */
    private java.lang.String hasDependentInd;

    /** The value of the simple sourceKey1 property. */
    private java.lang.String sourceKey1;

    /** The value of the simple sourceKey2 property. */
    private java.lang.String sourceKey2;

    /** The value of the simple sourceKey3 property. */
    private java.lang.String sourceKey3;

    /** The value of the simple sourceKey4 property. */
    private java.lang.String sourceKey4;

    /**
    * Simple constructor of AbstractHierarchyTreeDetail instances.
    */
    public AbstractHierarchyTreeDetail()
    {
    }

    /**
    * Constructor of AbstractHierarchyTreeDetail instances given a composite primary key.
    * @param id
    */
    public AbstractHierarchyTreeDetail(HierarchyTreeDetailKey id)
    {
    this.setId(id);
    }

    /**
    * Return the composite id instance that identifies this object.
    * @return HierarchyTreeDetailKey
    */
    public HierarchyTreeDetailKey getId()
    {
    return this.id;
    }

    /**
    * Set the composite id instance that identifies this object.
    * @param id
    */
    public void setId(HierarchyTreeDetailKey id)
    {
    this.hashValue = 0;
    this.id = id;
    }

    /**
    * Return the value of the HIERARCHY_NODE_PAR_CD column.
    * @return java.lang.Long
    */
    public java.lang.Long getHierarchyNodeParCd()
    {
    return this.hierarchyNodeParCd;
    }

    /**
    * Set the value of the HIERARCHY_NODE_PAR_CD column.
    * @param hierarchyNodeParCd
    */
    public void setHierarchyNodeParCd(java.lang.Long hierarchyNodeParCd)
    {
    this.hierarchyNodeParCd = hierarchyNodeParCd;
    }

    /**
    * Return the value of the NODE_NAME column.
    * @return java.lang.String
    */
    public java.lang.String getNodeName()
    {
    return this.nodeName;
    }

    /**
    * Set the value of the NODE_NAME column.
    * @param nodeName
    */
    public void setNodeName(java.lang.String nodeName)
    {
    this.nodeName = nodeName;
    }

    /**
    * Return the value of the ACTIVATION_DATE column.
    * @return java.util.Date
    */
    public java.util.Date getActivationDate()
    {
    return this.activationDate;
    }

    /**
    * Set the value of the ACTIVATION_DATE column.
    * @param activationDate
    */
    public void setActivationDate(java.util.Date activationDate)
    {
    this.activationDate = activationDate;
    }

    /**
    * Return the value of the DEACTIVATION_DATE column.
    * @return java.util.Date
    */
    public java.util.Date getDeactivationDate()
    {
    return this.deactivationDate;
    }

    /**
    * Set the value of the DEACTIVATION_DATE column.
    * @param deactivationDate
    */
    public void setDeactivationDate(java.util.Date deactivationDate)
    {
    this.deactivationDate = deactivationDate;
    }

    /**
    * Return the value of the CREATED_TS column.
    * @return java.util.Date
    */
    public java.util.Date getCreatedTs()
    {
    return this.createdTs;
    }

    /**
    * Set the value of the CREATED_TS column.
    * @param createdTs
    */
    public void setCreatedTs(java.util.Date createdTs)
    {
    this.createdTs = createdTs;
    }

    /**
    * Return the value of the CREATED_BY column.
    * @return java.lang.String
    */
    public java.lang.String getCreatedBy()
    {
    return this.createdBy;
    }

    /**
    * Set the value of the CREATED_BY column.
    * @param createdBy
    */
    public void setCreatedBy(java.lang.String createdBy)
    {
    this.createdBy = createdBy;
    }

    /**
    * Return the value of the MODIFIED_TS column.
    * @return java.util.Date
    */
    public java.util.Date getModifiedTs()
    {
    return this.modifiedTs;
    }

    /**
    * Set the value of the MODIFIED_TS column.
    * @param modifiedTs
    */
    public void setModifiedTs(java.util.Date modifiedTs)
    {
    this.modifiedTs = modifiedTs;
    }

    /**
    * Return the value of the MODIFIED_BY column.
    * @return java.lang.String
    */
    public java.lang.String getModifiedBy()
    {
    return this.modifiedBy;
    }

    /**
    * Set the value of the MODIFIED_BY column.
    * @param modifiedBy
    */
    public void setModifiedBy(java.lang.String modifiedBy)
    {
    this.modifiedBy = modifiedBy;
    }

    /**
    * Return the value of the LEVEL_CD column.
    * @return java.lang.Long
    */
    public java.lang.Long getLevelCd()
    {
    return this.levelCd;
    }

    /**
    * Set the value of the LEVEL_CD column.
    * @param levelCd
    */
    public void setLevelCd(java.lang.Long levelCd)
    {
    this.levelCd = levelCd;
    }

    /**
    * Return the value of the HAS_DEPENDENT_IND column.
    * @return java.lang.String
    */
    public java.lang.String getHasDependentInd()
    {
    return this.hasDependentInd;
    }

    /**
    * Set the value of the HAS_DEPENDENT_IND column.
    * @param hasDependentInd
    */
    public void setHasDependentInd(java.lang.String hasDependentInd)
    {
    this.hasDependentInd = hasDependentInd;
    }

    /**
    * Return the value of the SOURCE_KEY_1 column.
    * @return java.lang.String
    */
    public java.lang.String getSourceKey1()
    {
    return this.sourceKey1;
    }

    /**
    * Set the value of the SOURCE_KEY_1 column.
    * @param sourceKey1
    */
    public void setSourceKey1(java.lang.String sourceKey1)
    {
    this.sourceKey1 = sourceKey1;
    }

    /**
    * Return the value of the SOURCE_KEY_2 column.
    * @return java.lang.String
    */
    public java.lang.String getSourceKey2()
    {
    return this.sourceKey2;
    }

    /**
    * Set the value of the SOURCE_KEY_2 column.
    * @param sourceKey2
    */
    public void setSourceKey2(java.lang.String sourceKey2)
    {
    this.sourceKey2 = sourceKey2;
    }

    /**
    * Return the value of the SOURCE_KEY_3 column.
    * @return java.lang.String
    */
    public java.lang.String getSourceKey3()
    {
    return this.sourceKey3;
    }

    /**
    * Set the value of the SOURCE_KEY_3 column.
    * @param sourceKey3
    */
    public void setSourceKey3(java.lang.String sourceKey3)
    {
    this.sourceKey3 = sourceKey3;
    }

    /**
    * Return the value of the SOURCE_KEY_4 column.
    * @return java.lang.String
    */
    public java.lang.String getSourceKey4()
    {
    return this.sourceKey4;
    }

    /**
    * Set the value of the SOURCE_KEY_4 column.
    * @param sourceKey4
    */
    public void setSourceKey4(java.lang.String sourceKey4)
    {
    this.sourceKey4 = sourceKey4;
    }

    /**
    * Implementation of the equals comparison on the basis of equality of the primary key values.
    * @param rhs
    * @return boolean
    */
    public boolean equals(Object rhs)
    {
    if (rhs == null)
    return false;
    if (! (rhs instanceof HierarchyTreeDetail))
    return false;
    HierarchyTreeDetail that = (HierarchyTreeDetail) rhs;
    if (this.getId() != null && that.getId() != null)
    {
    return (this.getId().equals(that.getId()));
    }
    return true;
    }

    /**
    * Implementation of the hashCode method conforming to the Bloch pattern with
    * the exception of array properties (these are very unlikely primary key types).
    * @return int
    */
    public int hashCode()
    {
    if (this.hashValue == 0)
    {
    int result = 17;
    if (this.getId() == null)
    {
    result = super.hashCode();
    }
    else
    {
    result = this.getId().hashCode();
    }
    this.hashValue = result;
    }
    return this.hashValue;
    }
    }
    HierarchyTreeDetail

    /*
    * Created Fri Apr 15 13:07:54 CDT 2005 by MyEclipse Hibernate Tool.
    */
    package com.kraft.rbac.domain;

    import java.io.Serializable;

    /**
    * A class that represents a row in the ‘HIERARCHY_TREE_DETAIL’ table.
    * This class may be customized as it is never re-generated
    * after being created.
    */
    public class HierarchyTreeDetail
    extends AbstractHierarchyTreeDetail
    implements Serializable
    {
    /**
    * Simple constructor of HierarchyTreeDetail instances.
    */
    public HierarchyTreeDetail()
    {
    }

    /**
    * Constructor of HierarchyTreeDetail instances given a composite primary key.
    * @param id
    */
    public HierarchyTreeDetail(HierarchyTreeDetailKey id)
    {
    super(id);
    }

    /* Add customized code below */

    }

    HierarchyTreeDetailKey

    /*
    * WARNING: DO NOT EDIT THIS FILE. This is a generated file that is synchronized
    * by MyEclipse Hibernate tool integration.
    *
    * Created Fri Apr 15 13:07:54 CDT 2005 by MyEclipse Hibernate Tool.
    */
    package com.kraft.rbac.domain;

    import java.io.Serializable;

    /**
    * A class representing a composite primary key id for the HIERARCHY_TREE_DETAIL
    * table. This object should only be instantiated for use with instances
    * of the HierarchyTreeDetail class.
    */
    public class HierarchyTreeDetailKey
    implements Serializable
    {
    /** The cached hash code value for this instance. Settting to 0 triggers re-calculation. */
    private volatile int hashValue = 0;

    /** The value of the HIERARCHY_NODE_CD component of this composite id. */
    private HierarchyTreeDetail hierarchyTreeDetail;

    /** The value of the HIERARCHY_TREE_CD component of this composite id. */
    private HierarchyTreeDetail hierarchyTreeDetail1;

    /**
    * Simple constructor of HierarchyTreeDetailKey instances.
    */
    public HierarchyTreeDetailKey()
    {
    }

    /**
    * Returns the value of the hierarchyTreeDetail property.
    * @return HierarchyTreeDetail
    */
    public HierarchyTreeDetail getHierarchyTreeDetail()
    {
    return hierarchyTreeDetail;
    }

    /**
    * Sets the value of the hierarchyTreeDetail property.
    * @param hierarchyTreeDetail
    */
    public void setHierarchyTreeDetail(HierarchyTreeDetail hierarchyTreeDetail)
    {
    hashValue = 0;
    this.hierarchyTreeDetail = hierarchyTreeDetail;
    }

    /**
    * Returns the value of the hierarchyTreeDetail1 property.
    * @return HierarchyTreeDetail
    */
    public HierarchyTreeDetail getHierarchyTreeDetail1()
    {
    return hierarchyTreeDetail1;
    }

    /**
    * Sets the value of the hierarchyTreeDetail1 property.
    * @param hierarchyTreeDetail1
    */
    public void setHierarchyTreeDetail1(HierarchyTreeDetail hierarchyTreeDetail1)
    {
    hashValue = 0;
    this.hierarchyTreeDetail1 = hierarchyTreeDetail1;
    }

    /**
    * Implementation of the equals comparison on the basis of equality of the id components.
    * @param rhs
    * @return boolean
    */
    public boolean equals(Object rhs)
    {
    if (rhs == null)
    return false;
    if (! (rhs instanceof HierarchyTreeDetailKey))
    return false;
    HierarchyTreeDetailKey that = (HierarchyTreeDetailKey) rhs;
    if (this.getHierarchyTreeDetail() != null && that.getHierarchyTreeDetail() != null)
    {
    if (! this.getHierarchyTreeDetail().equals(that.getHierarchyTreeDetail()))
    {
    return false;
    }
    }
    if (this.getHierarchyTreeDetail1() != null && that.getHierarchyTreeDetail1() != null)
    {
    if (! this.getHierarchyTreeDetail1().equals(that.getHierarchyTreeDetail1()))
    {
    return false;
    }
    }
    return true;
    }

    /**
    * Implementation of the hashCode method conforming to the Bloch pattern with
    * the exception of array properties (these are very unlikely primary key types).
    * @return int
    */
    public int hashCode()
    {
    if (this.hashValue == 0)
    {
    int result = 17;
    int hierarchyTreeDetailValue = this.getHierarchyTreeDetail() == null ? 0 : this.getHierarchyTreeDetail().hashCode();
    result = result * 37 + hierarchyTreeDetailValue;
    int hierarchyTreeDetail1Value = this.getHierarchyTreeDetail1() == null ? 0 : this.getHierarchyTreeDetail1().hashCode();
    result = result * 37 + hierarchyTreeDetail1Value;
    this.hashValue = result;
    }
    return this.hashValue;
    }
    }

    HierarchyTreeDetail.hbm.xml

    <?xml version=”1.0″?>
    <!DOCTYPE hibernate-mapping PUBLIC
    “-//Hibernate/Hibernate Mapping DTD 2.0//EN”
    http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd&#8221; >

    <!– DO NOT EDIT: This is a generated file that is synchronized –>
    <!– by MyEclipse Hibernate tool integration. –>
    <!– Created Fri Apr 15 13:07:54 CDT 2005 –>
    <hibernate-mapping package=”com.kraft.rbac.domain”>

    <class name=”HierarchyTreeDetail” table=”HIERARCHY_TREE_DETAIL”>
    <composite-id name=”id” class=”HierarchyTreeDetailKey”>
    <key-many-to-one name=”hierarchyTreeDetail” column=”HIERARCHY_NODE_CD” class=”HierarchyTreeDetail”/>
    <key-many-to-one name=”hierarchyTreeDetail1″ column=”HIERARCHY_TREE_CD” class=”HierarchyTreeDetail”/>
    </composite-id>

    <property name=”hierarchyNodeParCd” column=”HIERARCHY_NODE_PAR_CD” type=”java.lang.Long” />
    <property name=”nodeName” column=”NODE_NAME” type=”java.lang.String” />
    <property name=”activationDate” column=”ACTIVATION_DATE” type=”java.util.Date” />
    <property name=”deactivationDate” column=”DEACTIVATION_DATE” type=”java.util.Date” />
    <property name=”createdTs” column=”CREATED_TS” type=”java.util.Date” />
    <property name=”createdBy” column=”CREATED_BY” type=”java.lang.String” />
    <property name=”modifiedTs” column=”MODIFIED_TS” type=”java.util.Date” />
    <property name=”modifiedBy” column=”MODIFIED_BY” type=”java.lang.String” />
    <property name=”levelCd” column=”LEVEL_CD” type=”java.lang.Long” />
    <property name=”hasDependentInd” column=”HAS_DEPENDENT_IND” type=”java.lang.String” />
    <property name=”sourceKey1″ column=”SOURCE_KEY_1″ type=”java.lang.String” />
    <property name=”sourceKey2″ column=”SOURCE_KEY_2″ type=”java.lang.String” />
    <property name=”sourceKey3″ column=”SOURCE_KEY_3″ type=”java.lang.String” />
    <property name=”sourceKey4″ column=”SOURCE_KEY_4″ type=”java.lang.String” />
    </class>

    </hibernate-mapping>

    hibernate.cfg.xml

    <?xml version=’1.0′ encoding=’UTF-8′?>
    <!DOCTYPE hibernate-configuration PUBLIC
    “-//Hibernate/Hibernate Configuration DTD 2.0//EN”
    http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd”&gt;

    <!– DO NOT EDIT: This is a generated file that is synchronized –>
    <!– by MyEclipse Hibernate tool integration. –>
    <hibernate-configuration>

    <session-factory>
    <!– properties –>
    <property name=”connection.username”>kcjxl52</property>
    <property name=”connection.url”>jdbc:oracle:thin:@wi1077.wb.us.pm.com:1521:d64i0</property>
    <property name=”dialect”>net.sf.hibernate.dialect.Oracle9Dialect</property>
    <property name=”connection.password”>kcjxl52</property>
    <property name=”connection.driver_class”>oracle.jdbc.driver.OracleDriver</property>

    <!– mapping files –>
    <mapping resource=”com/kraft/rbac/domain/RbacSubscribedUsers.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/HierarchyTreeDetail.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/HierarchyTypes.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/HierarchyTrees.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/RequestStatusCodes.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/ApplicationAssignment.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/ApproverResponses.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/Applications.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/BusinessAreaRoleXref.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/ApplicationRoleAssignment.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/ApplicationPortfolio.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/ApplicationValue.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/DefaultApprovers.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/RequestTypes.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/RequestTree.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/RoleHierarchyXref.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/StepLookup.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/Roles.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/Requests.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/RoleAssignment.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/ResponsibilityAssignment.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/AppRoleXref.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/BusinessAreas.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/Previewers.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/RequestApproverStatus.hbm.xml”/>
    <mapping resource=”com/kraft/rbac/domain/SourceKeyTranslationTypes.hbm.xml”/>

    </session-factory>

    </hibernate-configuration>

    AbstractResponsibilityAssignment

    /*
    * WARNING: DO NOT EDIT THIS FILE. This is a generated file that is synchronized
    * by MyEclipse Hibernate tool integration.
    *
    * Created Fri Apr 15 13:07:55 CDT 2005 by MyEclipse Hibernate Tool.
    */
    package com.kraft.rbac.domain;

    import java.io.Serializable;

    /**
    * A class that represents a row in the RESPONSIBILITY_ASSIGNMENT table.
    * You can customize the behavior of this class by editing the class, {@link ResponsibilityAssignment()}.
    * WARNING: DO NOT EDIT THIS FILE. This is a generated file that is synchronized * by MyEclipse Hibernate tool integration.
    */
    public abstract class AbstractResponsibilityAssignment
    implements Serializable
    {
    /** The cached hash code value for this instance. Settting to 0 triggers re-calculation. */
    private int hashValue = 0;

    /** The composite primary key value. */
    private java.lang.String responsibilityAssignmentId;

    /** The value of the applicationRoleAssignment association. */
    private ApplicationRoleAssignment applicationRoleAssignment;

    /** The value of the hierarchyTreeDetail association. */
    private HierarchyTreeDetail hierarchyTreeDetail;

    /** The value of the hierarchyTreeDetail1 association. */
    private HierarchyTreeDetail hierarchyTreeDetail1;

    /** The value of the rbacSubscribedUsers association. */
    private RbacSubscribedUsers rbacSubscribedUsers;

    /** The value of the requests association. */
    private Requests requests;

    /** The value of the simple activationDate property. */
    private java.util.Date activationDate;

    /** The value of the simple deactivationDate property. */
    private java.util.Date deactivationDate;

    /** The value of the simple activeFlg property. */
    private java.lang.String activeFlg;

    /** The value of the simple finalReactivationDate property. */
    private java.util.Date finalReactivationDate;

    /**
    * Simple constructor of AbstractResponsibilityAssignment instances.
    */
    public AbstractResponsibilityAssignment()
    {
    }

    /**
    * Constructor of AbstractResponsibilityAssignment instances given a simple primary key.
    * @param responsibilityAssignmentId
    */
    public AbstractResponsibilityAssignment(java.lang.String responsibilityAssignmentId)
    {
    this.setResponsibilityAssignmentId(responsibilityAssignmentId);
    }

    /**
    * Return the simple primary key value that identifies this object.
    * @return java.lang.String
    */
    public java.lang.String getResponsibilityAssignmentId()
    {
    return responsibilityAssignmentId;
    }

    /**
    * Set the simple primary key value that identifies this object.
    * @param responsibilityAssignmentId
    */
    public void setResponsibilityAssignmentId(java.lang.String responsibilityAssignmentId)
    {
    this.hashValue = 0;
    this.responsibilityAssignmentId = responsibilityAssignmentId;
    }

    /**
    * Return the value of the GLOBAL_ID column.
    * @return RbacSubscribedUsers
    */
    public RbacSubscribedUsers getRbacSubscribedUsers()
    {
    return this.rbacSubscribedUsers;
    }

    /**
    * Set the value of the GLOBAL_ID column.
    * @param rbacSubscribedUsers
    */
    public void setRbacSubscribedUsers(RbacSubscribedUsers rbacSubscribedUsers)
    {
    this.rbacSubscribedUsers = rbacSubscribedUsers;
    }

    /**
    * Return the value of the ACTIVATION_DATE column.
    * @return java.util.Date
    */
    public java.util.Date getActivationDate()
    {
    return this.activationDate;
    }

    /**
    * Set the value of the ACTIVATION_DATE column.
    * @param activationDate
    */
    public void setActivationDate(java.util.Date activationDate)
    {
    this.activationDate = activationDate;
    }

    /**
    * Return the value of the DEACTIVATION_DATE column.
    * @return java.util.Date
    */
    public java.util.Date getDeactivationDate()
    {
    return this.deactivationDate;
    }

    /**
    * Set the value of the DEACTIVATION_DATE column.
    * @param deactivationDate
    */
    public void setDeactivationDate(java.util.Date deactivationDate)
    {
    this.deactivationDate = deactivationDate;
    }

    /**
    * Return the value of the ACTIVE_FLG column.
    * @return java.lang.String
    */
    public java.lang.String getActiveFlg()
    {
    return this.activeFlg;
    }

    /**
    * Set the value of the ACTIVE_FLG column.
    * @param activeFlg
    */
    public void setActiveFlg(java.lang.String activeFlg)
    {
    this.activeFlg = activeFlg;
    }

    /**
    * Return the value of the FINAL_REACTIVATION_DATE column.
    * @return java.util.Date
    */
    public java.util.Date getFinalReactivationDate()
    {
    return this.finalReactivationDate;
    }

    /**
    * Set the value of the FINAL_REACTIVATION_DATE column.
    * @param finalReactivationDate
    */
    public void setFinalReactivationDate(java.util.Date finalReactivationDate)
    {
    this.finalReactivationDate = finalReactivationDate;
    }

    /**
    * Return the value of the ADD_REQUEST_ID column.
    * @return Requests
    */
    public Requests getRequests()
    {
    return this.requests;
    }

    /**
    * Set the value of the ADD_REQUEST_ID column.
    * @param requests
    */
    public void setRequests(Requests requests)
    {
    this.requests = requests;
    }

    /**
    * Return the value of the APPLICATION_ROLE_ASSIGNMENT_ID column.
    * @return ApplicationRoleAssignment
    */
    public ApplicationRoleAssignment getApplicationRoleAssignment()
    {
    return this.applicationRoleAssignment;
    }

    /**
    * Set the value of the APPLICATION_ROLE_ASSIGNMENT_ID column.
    * @param applicationRoleAssignment
    */
    public void setApplicationRoleAssignment(ApplicationRoleAssignment applicationRoleAssignment)
    {
    this.applicationRoleAssignment = applicationRoleAssignment;
    }

    /**
    * Return the value of the HIERARCHY_NODE_CD column.
    * @return HierarchyTreeDetail
    */
    public HierarchyTreeDetail getHierarchyTreeDetail()
    {
    return this.hierarchyTreeDetail;
    }

    /**
    * Set the value of the HIERARCHY_NODE_CD column.
    * @param hierarchyTreeDetail
    */
    public void setHierarchyTreeDetail(HierarchyTreeDetail hierarchyTreeDetail)
    {
    this.hierarchyTreeDetail = hierarchyTreeDetail;
    }

    /**
    * Return the value of the HIERARCHY_TREE_CD column.
    * @return HierarchyTreeDetail
    */
    public HierarchyTreeDetail getHierarchyTreeDetail1()
    {
    return this.hierarchyTreeDetail1;
    }

    /**
    * Set the value of the HIERARCHY_TREE_CD column.
    * @param hierarchyTreeDetail1
    */
    public void setHierarchyTreeDetail1(HierarchyTreeDetail hierarchyTreeDetail1)
    {
    this.hierarchyTreeDetail1 = hierarchyTreeDetail1;
    }

    /**
    * Implementation of the equals comparison on the basis of equality of the primary key values.
    * @param rhs
    * @return boolean
    */
    public boolean equals(Object rhs)
    {
    if (rhs == null)
    return false;
    if (! (rhs instanceof ResponsibilityAssignment))
    return false;
    ResponsibilityAssignment that = (ResponsibilityAssignment) rhs;
    if (this.getResponsibilityAssignmentId() != null && that.getResponsibilityAssignmentId() != null)
    {
    if (! this.getResponsibilityAssignmentId().equals(that.getResponsibilityAssignmentId()))
    {
    return false;
    }
    }
    return true;
    }

    /**
    * Implementation of the hashCode method conforming to the Bloch pattern with
    * the exception of array properties (these are very unlikely primary key types).
    * @return int
    */
    public int hashCode()
    {
    if (this.hashValue == 0)
    {
    int result = 17;
    int responsibilityAssignmentIdValue = this.getResponsibilityAssignmentId() == null ? 0 : this.getResponsibilityAssignmentId().hashCode();
    result = result * 37 + responsibilityAssignmentIdValue;
    this.hashValue = result;
    }
    return this.hashValue;
    }
    }

    ResponsibilityAssignment

    /*
    * Created Fri Apr 15 13:07:56 CDT 2005 by MyEclipse Hibernate Tool.
    */
    package com.kraft.rbac.domain;

    import java.io.Serializable;

    /**
    * A class that represents a row in the ‘RESPONSIBILITY_ASSIGNMENT’ table.
    * This class may be customized as it is never re-generated
    * after being created.
    */
    public class ResponsibilityAssignment
    extends AbstractResponsibilityAssignment
    implements Serializable
    {
    /**
    * Simple constructor of ResponsibilityAssignment instances.
    */
    public ResponsibilityAssignment()
    {
    }

    /**
    * Constructor of ResponsibilityAssignment instances given a simple primary key.
    * @param responsibilityAssignmentId
    */
    public ResponsibilityAssignment(java.lang.String responsibilityAssignmentId)
    {
    super(responsibilityAssignmentId);
    }

    /* Add customized code below */

    }

    ResponsibilityAssignment.hbm.xml

    <?xml version=”1.0″?>
    <!DOCTYPE hibernate-mapping PUBLIC
    “-//Hibernate/Hibernate Mapping DTD 2.0//EN”
    http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd&#8221; >

    <!– DO NOT EDIT: This is a generated file that is synchronized –>
    <!– by MyEclipse Hibernate tool integration. –>
    <!– Created Fri Apr 15 13:07:55 CDT 2005 –>
    <hibernate-mapping package=”com.kraft.rbac.domain”>

    <class name=”ResponsibilityAssignment” table=”RESPONSIBILITY_ASSIGNMENT”>
    <id name=”responsibilityAssignmentId” column=”RESPONSIBILITY_ASSIGNMENT_ID” type=”java.lang.String”>
    <generator class=”uuid.string”/>
    </id>

    <property name=”activationDate” column=”ACTIVATION_DATE” type=”java.util.Date” />
    <property name=”deactivationDate” column=”DEACTIVATION_DATE” type=”java.util.Date” />
    <property name=”activeFlg” column=”ACTIVE_FLG” type=”java.lang.String” />
    <property name=”finalReactivationDate” column=”FINAL_REACTIVATION_DATE” type=”java.util.Date” />

    <many-to-one name=”applicationRoleAssignment” column=”APPLICATION_ROLE_ASSIGNMENT_ID” class=”ApplicationRoleAssignment” not-null=”true” />

    <many-to-one name=”hierarchyTreeDetail” column=”HIERARCHY_NODE_CD” class=”HierarchyTreeDetail” not-null=”true” />

    <many-to-one name=”hierarchyTreeDetail1″ column=”HIERARCHY_TREE_CD” class=”HierarchyTreeDetail” not-null=”true” />

    <many-to-one name=”rbacSubscribedUsers” column=”GLOBAL_ID” class=”RbacSubscribedUsers” />

    <many-to-one name=”requests” column=”ADD_REQUEST_ID” class=”Requests” not-null=”true” />
    </class>

    </hibernate-mapping>

    #228206 Reply

    Riyad Kalla
    Member

    How did you create the hbm.xml files and hibernate.cfg.xml file? Did you use our mapping tool? Can you please post all the information we request in the [URL=http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-393.html]Posting Guidelines[/URL] thread at the top of this forum? That will give us some context so that we can determine if this is an installation issue, a configuration problem, or a bug. Thanks.

    #228251 Reply

    ketaj27
    Member

    Here are the additional details. I hope they clarify the situation. Thanks for your help.

    Eclipse Platform: 3.0.1
    MyEclipse: 3.8.4
    OS: WinXP Pro V. 2002 SP-1
    Database: Orace 9i Enterprise Edition Release 9.2.0.5.0
    Oracle JDBC driver
    Java JDK 1.4

    I generated the Java classes and Hiberntate xml configuration files by connecting to the Oracle database, selecting the appropriate tables (approximately 28 tables at a time) right click and select “Create Hibernate Mapping”. I did not note any exceptions in the Eclipse log file.

    Please let me know if there are additional questions.

    #228284 Reply

    ketaj27
    Member

    By the way, I generated this code using MyEclipse 3.8.4

    #228289 Reply

    Riyad Kalla
    Member

    I have asked our hibernate developer to take a look at this, but considering it’s length and how swamped we are right now there might be some lag before he can reply.

    #228291 Reply

    support-jeff
    Member

    The main issue is the following m2o association defined in ResponsibilityAssignment.hbm.xml:

    <many-to-one name=”hierarchyTreeDetail” column=”HIERARCHY_NODE_CD” class=”HierarchyTreeDetail” not-null=”true” />
    <many-to-one name=”hierarchyTreeDetail1″ column=”HIERARCHY_TREE_CD” class=”HierarchyTreeDetail” not-null=”true” />

    There is a known issue in the ME Hibernate toolset with multi-column m2o associations. This should be mapped as:

    <many-to-one name=”hierarchyTreeDetail” class=”HierarchyTreeDetail” not-null=”true” >
    <column name=”HIERARCHY_NODE_CD” />
    <column name=”HIERARCHY_TREE_CD” />
    </many-to-one>

    The source code in AbstractResponsibilityAssignment.java must also be adjusted.

    One other potential problem that may arise: why do have a FK relationship defined on the PK of HierarchyTreeDetail back to itself? Not sure what the effect would be, but is it truly inteneded this way? Seems to me that you would end up with only one row in the table….ever. It also leads to the mapping file using key-many-to-one mappings for the composite-id on the class. If it is intended (and actually works this way), then the same bug noted above applies to the key-many-to-one mappings.

    #230117 Reply

    merlyn
    Member

    Hi Jeff,

    this is exactly the same issue I am having. I have 20+ tables many of which have composite primary keys. This results in changes being required to almost every XXXKey.java, XXX.java and XXX.hbm.xml.

    I have version 3.8.2+QF2 of MyEclipse. Has this issue been resolved yet do you know?

    Thanks,
    merlyn

    #230180 Reply

    support-jeff
    Member

    yes, it is a pain. The fix will arrive shortly though. Give it a few more weeks.

    #230194 Reply

    ketaj27
    Member

    By the way, your recommendation for correcting this issue has worked. Thanks for the assistance.

    #230481 Reply

    brianfoley
    Member

    I just started using Hibernate and ran straight into this problem. I found this post and noticed that the date was quite old (1+ yr ago)… is there a fix to this problem available?

    Thanks,
    Brian

    #230485 Reply

    Riyad Kalla
    Member

    Brian not yet, we hope to address this with the 4.0 release that is currently in Milestone testing with some major new functionality.

    #230502 Reply

    support-jeff
    Member

    Brian – also note that the original post is only a little over a month old, not a year. THe hibernate tooling in ME is not even a year old yet. Just a clarification.

    #230532 Reply

    brianfoley
    Member

    My fault… I was looking at the “joined date” and mistaking that for posting dates.

    Thanks,
    Brian

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Problem with # of foreign columns <> to primary key co

You must be logged in to post in the forum log in