- This topic has 2 replies, 2 voices, and was last updated 15 years, 10 months ago by SharonMP.
-
AuthorPosts
-
SharonMPMemberHi,
When I used MyEclipse to reverse engineer some legacy tables, the following was generated in one of the hbm.xml files:
<many-to-one name="Report" class="Report" fetch="select"> <column name="FORMAT_ID" precision="7" scale="0" not-null="true" /> </many-to-one>
<many-to-one name="TestResult" class="TestResult" fetch="select"> <column name="A_ID" precision="7" scale="0" not-null="true" /> <column name="P_ID" precision="7" scale="0" not-null="true" /> <column name="S_ID" precision="7" scale="0" not-null="true" /> <column name="T_CODE" length="10" not-null="true" /> <column name="T_COUNT" precision="3" scale="0" not-null="true" /> </many-to-one>
I have been trying to access FORMAT_ID and A_ID but am unable to do so.
Could you please provide some pointers?
Thanks,
Sharon
Brian FernandesModeratorSharon,
I’m afraid your question is a bit too low level for us to help. Can you provide the DDL for the two tables involved here and which columns you wish to access from the table at the other end of the relationship?
SharonMPMemberHi Brian,
Thank you for the reply. The DDL for the tables involved are:
TABLE TEST_RESULTS_ENTRY ( TEST_RESULTS_ID NUMBER NOT NULL, A_ID NUMBER(7) NOT NULL, P_ID NUMBER(7) NOT NULL, S_ID NUMBER(7) NOT NULL, FORMAT_ID NUMBER(7) NOT NULL, T_CODE VARCHAR2(10 BYTE) NOT NULL, T_COUNT NUMBER(3) NOT NULL, R_SEQ NUMBER(2) NOT NULL, R_NAME VARCHAR2(15 BYTE) NOT NULL, R_TYPE VARCHAR2(15 BYTE) NOT NULL, R_VALUE VARCHAR2(4000 BYTE), ) PRIMARY KEY: TEST_RESULTS_ID TABLE REPORT ( FORMAT_ID NUMBER(2) NOT NULL, DESCRIPTION VARCHAR2(80 BYTE), ) PRIMARY KEY: FORMAT_ID CREATE TABLE TESTRESULT ( A_ID NUMBER(7) NOT NULL, P_ID NUMBER(7) NOT NULL, S_ID NUMBER(7) NOT NULL, T_CODE VARCHAR2(10 BYTE) NOT NULL, T_COUNT NUMBER(3) NOT NULL, LUN VARCHAR2(30 BYTE), LUD DATE ) PRIMARY KEYS: A_ID, P_ID, S_ID, T_CODE, T_COUNT
As mentioned in the previous post, MyEclipse generated the following code in TestResultsEntry.hbm.xml:
<many-to-one name="Report" class="Report" fetch="select"> <column name="FORMAT_ID" precision="7" scale="0" not-null="true" /> </many-to-one> <many-to-one name="TestResult" class="TestResult" fetch="select"> <column name="A_ID" precision="7" scale="0" not-null="true" /> <column name="P_ID" precision="7" scale="0" not-null="true" /> <column name="S_ID" precision="7" scale="0" not-null="true" /> <column name="T_CODE" length="10" not-null="true" /> <column name="T_COUNT" precision="3" scale="0" not-null="true" /> </many-to-one>
I am trying to use the fields FORMAT_ID, A_ID, P_ID, S_ID, T_CODE and T_COUNT to perform a join as shown below:
"...from TestResultsEntry tre, Report r, TestResult tr where tre.formatId = r.formatId and tre.aId = tr.aId ..."
However, these columns appear only in the many-to-one associations and not as individual properties. Thus, I am unable to use the column names in queries. Is there a workaround to make MyEclipse generate both properties and the associations?
Regards,
Sharon -
AuthorPosts