views:

25

answers:

0

hi, These are my classes.

public Class ClassA {
 int a;
 ClassB b;
public int getA(){return a;}
public ClassB  getB(){return b;}
}
public Class ClassP {
 int p;
 int q;
 int r;
public int getP(){return p;}
public int getQ(){return q;}
public int getR(){return r;}
}

these are my class. previously i was loading above using many-to-one mapping.as Class A conatined an object of Class B. this is the mapping file by which i used to load the class

<class name="test.ClassA" table = "talbe_a">
<id name="a" column="a" type ="int"/>
<many-to-one name="b" class="test.ClassB">
  <column name="b"/>
</many-to-one>
</class>

but now i have to remove the dependency of both the classes. so my classes wud be like

public Class ClassA {
     int a;
     int b;
     int c;
    public int getA(){return a;}
    public int getB(){return b;}
    public int getC(){return c;}
   }
    public Class ClassP {
     int p;
     int q;
     int r;
    public int getP(){return p;}
    public int getQ(){return q;}
    public int getR(){return r;}
    }

no i need to load the ClassA, in which i have the key element of ClassB and an attribute "c" of ClassB. is it possible to load like this. I have the attribute "a" and "b" in table_a but i need to load atribute "c" from table_b which is mapped in classB. Is it possible to load as such??... plz help me