db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shashidhara <shashidhara.krina...@wipro.com>
Subject Help needed in mapping
Date Sun, 27 Jul 2003 15:48:48 GMT

Hi

I am facing problem when i do mapping Object to DataBase table.

i have Two Objects

1. Booking Object
2. ProfileObject

And Booking Object contains Profile Object like,

class Booking
{
 private long BookingNo = 0;
 private int TimeSlot = 0;
 private String Office = null;
 private String Location = null;
 private Profile profile = null;
 private String BookingStatus = null;
 private String BookedDt = null;
 private java.sql.Date SqlBookedDt = null;
 private String BookedTime = null;
 private String AmPm = null;
}

class Profile
{
 public int EmpNo = 0;
 public String EmpOffice = null;
 public String EmpLocation = null;
 public String MainArea = null;
 public String SubArea = null;
 public String LandMark = null;
 public String Status = null;
 public String ProfileExists = null;
}

Tables

 Booking Table : ADMIN_TT_REQUEST_TB


 NM_REQUEST_ID                             NOT NULL  NUMBER(10)
 NM_EMP_NUM                                 NOT NULL         NUMBER(8)
 DA_BOOKED_FOR                           NOT NULL           DATE
 VR_BOOKD_TIME                            NOT NULL          VARCHAR2(17
 VR_AMPM                                              VARCHAR2(2)
 VR_MAIN_AREA_ID                        NOT NULL            VARCHAR2(10
 VR_SUB_AREA_ID                                       VARCHAR2(10
 VR_LANDMARK                                          VARCHAR2(10
 VR_COMMENTS                                          VARCHAR2(10
 VR_ASSIGNED_TT                                       VARCHAR2(15
 CH_LOCKED                                     NOT NULL     CHAR(1)
 VR_STATUS
VARCHAR2(8)
 CH_POST_INSERT
CHAR(1)
 NM_TIME_SLOT_ID                        NOT NULL      NUMBER(3)
 VR_OFF_ID                                       NOT NULL
VARCHAR2(9)

Profile table : ADMIN_TT_EMP_TB

 NM_EMP_NUM                                NOT NULL NUMBER(8)
 VR_MAIN_AREA_ID                           NOT NULL VARCHAR2(10)
 VR_SUB_AREA_ID                                     VARCHAR2(10)
 VR_LANDMARK                                        VARCHAR2(100)
 VR_STATUS                                          VARCHAR2(8)
 VR_LOC_ID                                          VARCHAR2(9)
 VR_OFF_ID                                          VARCHAR2(9)

My requirement is,
i need to persist Booking object to ADMIN_TT_REQUEST_TB table,

Booking object contains the Profile object and it should not be
retrieved from database i.e from profile table,(It is a runtime object,
which already values)

So i defined mapping as,

<class-descriptor  class="org.apache.ojb.tt.businessentities.Profile"
table="ADMIN_TT_EMP_TB">

      <field-descriptor name="EmpNo" column="NM_EMP_NUM"
primarykey="true" jdbc-type="INTEGER"/>
      <field-descriptor    name="MainArea"     column="VR_MAIN_AREA_ID"
jdbc-type="VARCHAR" />
      <field-descriptor    name="SubArea"     column="VR_SUB_AREA_ID"
jdbc-type="VARCHAR" />
      <field-descriptor    name="LandMark"     column="VR_LANDMARK"
jdbc-type="VARCHAR" />
      <field-descriptor    name="Status"     column="VR_STATUS"
jdbc-type="VARCHAR" />
      <field-descriptor    name="EmpLocation"     column="VR_LOC_ID"
jdbc-type="VARCHAR" />
      <field-descriptor    name="EmpOffice"     column="VR_OFF_ID"
jdbc-type="VARCHAR" />
</class-descriptor>

<class-descriptor  class="org.apache.ojb.tt.businessentities.Booking"
table="ADMIN_TT_REQUEST_TB">

      <field-descriptor id="1" name="BookingNo" column="NM_REQUEST_ID"
primarykey="true" jdbc-type="INTEGER"/>
      <field-descriptor id="2"  name="EmpNo" column="NM_EMP_NUM"
jdbc-type="INTEGER"/>
      <field-descriptor id="3"  name="SqlBookedDt"
column="DA_BOOKED_FOR"  jdbc-type="DATE"/>
      <field-descriptor id="4"  name="BookedTime"
column="VR_BOOKD_TIME"  jdbc-type="VARCHAR"/>
      <field-descriptor id="5"  name="AmPm" column="VR_AMPM"
jdbc-type="VARCHAR"/>
      <field-descriptor id="6"  name="MainArea"
column="VR_MAIN_AREA_ID"  jdbc-type="VARCHAR"/>
      <field-descriptor id="7"  name="SubArea" column="VR_SUB_AREA_ID"
jdbc-type="VARCHAR"/>
      <field-descriptor id="8"  name="LandMark" column="VR_LANDMARK"
jdbc-type="VARCHAR"/>
      <field-descriptor id="14"  name="TimeSlot"
column="NM_TIME_SLOT_ID"  jdbc-type="INTEGER"/>
      <field-descriptor id="15"  name="VR_OFF_ID" column="VR_OFF_ID"
jdbc-type="VARCHAR"/>
      <field-descriptor id="16"  name="VR_LOC_ID" column="VR_OFF_ID"
jdbc-type="VARCHAR"/>
      <reference-descriptor name="profile"
class="org.apache.ojb.tt.businessentities.Profile"
auto-retrieve="false">
       <foreignkey field-id-ref="2"/>
       <foreignkey field-id-ref="6"/>
       <foreignkey field-id-ref="7"/>
       <foreignkey field-id-ref="8"/>
      <reference-descriptor>
</class-descriptor>

Even i have set auto-retrieve attribute to false so that OJB should take
directly the values, but

Error That i am getting is


java.lang.ExceptionInInitializerError:
org.apache.ojb.broker.metadata.MetadataException: Error creat
ing PersistentField: org.apache.ojb.tt.businessentities.TTBooking, EmpNo

        at
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:524)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
        at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
        at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:396)
        at
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(RepositoryPersistor.ja

va:296)
        at
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(RepositoryPer

sistor.java:207)
        at
org.apache.ojb.broker.metadata.MetadataManager.init(MetadataManager.java:85)

        at
org.apache.ojb.broker.metadata.MetadataManager.<init>(MetadataManager.java:76)

        at
org.apache.ojb.broker.metadata.MetadataManager.<clinit>(MetadataManager.java:67)

        at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.buildDefaultKey(Persistenc

eBrokerFactoryDefaultImpl.java:139)
        at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.<init>(PersistenceBrokerFa

ctoryDefaultImpl.java:110)
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:241)
        at
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(PersistenceBrokerFactoryF

actory.java:94)
        at
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.<clinit>(PersistenceBrokerFact

oryFactory.java:71)
        at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(PersistenceBroker

Factory.java:102)

Kindly help me if some one solution to this problem.

--
With Regards
shashi
-------------------------------------
Shashidhara.k
Senior System Engineer
Wipro Technologies Doddakannelli , Sarjapur Road, Bangalore - 560 035 ,
India .
Phone: 091-80-5056648 (Direct)
Visit us at http://careers.wipro.com
The World's first SEI CMM LEVEL 5 Software Services Company


**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message