You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Kishore Talagadadeevi <ta...@us.ibm.com> on 2004/08/12 17:57:19 UTC

URGENT ---> collection NOT RETURNED

   Env:   OJB 1.0/ ODMG api  on windows/AIX  running Websphere server..

                                           Dev:     Websphere Application 
Developement Studio ( WASD) with WAS test environment

                              Integration :      code running on dedicated 
Websphere 4.06 server.

             Use case scenario :       One user_ profile can have multiple 
partunumbers .So there are two tables  1.User_Profile  with other 
attributes.
                                                             2. chart_PN 
table having profile id attribute pointing to user profile id and part 
number as primary keys.

                                   Problem :        The partnumber 
collection for the user profile is empty while retrieving from db. But the 
data is available in database.
                                                              One 
noticeable point here is : This works in Dev env but it is not working in 
integration. I dont know why ..

Need help on  the following :
                                                          I would 
appreciate if some one could throw some light on the following :

                                                          1. Why it is not 
returning the collection ?
                                                          2. How do I 
enable debug information? I set all variables in log4j and ojb files to 
DEBUG . Still I am not
                                                              getting any 
debug information in my output console.

                                                          3. Are there any 
settings of ojb depending on Application server settings ???

 
 
 respository.xml :
--------------------------------------

<class-descriptor
          class="ojb.ChartProfilePn"
          table="CHART_PN">
           <field-descriptor
         name="profileId"
         column="CHART_PROFILE_ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="false"
         access="anonymous"
         conversion="ojb.conversion.UniqueIDIntegerFieldConversion"
      />
 
          <field-descriptor
         name="partNumber"
         column="PN"
         jdbc-type="CHAR"
         primarykey="true"
         autoincrement="false"
         conversion="ojb.conversion.TrimmedCharacterFieldConversion"
      />
 
                <reference-descriptor
                        name="profile"
                    class-ref="ojb.ChartProfileImpl"
                   >
                        <foreignkey field-ref="profileId"/>
                </reference-descriptor>
 
                <!-- Cache on a per request basis -->
                <attribute 
                        attribute-name="cacheClass" 
 attribute-value="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" 
                />
 
   </class-descriptor>
<class-descriptor 
                class="ojb.ChartProfileImpl" 
                table="USER_CHART_PROFILE">
 
                <field-descriptor
                        name="id"
                        column="CHART_PROFILE_ID"
                        jdbc-type="INTEGER"
                        primarykey="true"
                        autoincrement="true"
                        access="readonly"
 
conversion="procurement.sqms.server.session.ojb.conversion.UniqueIDIntegerFieldConversion"
                />
<collection-descriptor
                        name="Parts" 
 
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareCollection"
                        element-class-ref="ojb.ChartProfilePn" 
                        proxy="true"
                        auto-update="true"
                        > 
                        <inverse-foreignkey field-ref="profileId"/> 
                </collection-descriptor>
 
                <!-- Cache on a per request basis -->
                <attribute 
                        attribute-name="cacheClass" 
 attribute-value="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" 
                />

        </class-descriptor>
class files :
------------------
public interface ChartProfile {
 String[] getParts();
}
 class ChartProfileImpl implements ChartProfile
   {
      private List Parts = new ArrayList();

      public String[] getParts() {

        ArrayList partList = new ArrayList();
        Iterator iter = Parts.iterator();
        while (iter.hasNext()) {
            ChartProfilePnInt chartpn =
                (ChartProfilePnInt) iter.next();

            partList.add(chartIbmpn.getPartNumber());
        }
        return (String[]) partList.toArray(new String[partList.size()]);

      }

       public void setParts(String[] p) {

        ArrayList PartsList = new ArrayList();
        for (int i = 0; i < p.length; i++) {
            ChartProfilePn Part = new ChartProfilePn();
            Part.setPartNumber(p[i]);
            Part.setProfile(this);
            if (Part != null) {

                PartsList.add(Part);

            }

        }
        this.Parts = new ArrayList(PartsList);

    }

   }
interface ChartProfilePnInt extends Serializable {
 
        String getPartNumber();
        ChartProfile getProfile();

}
 class ChartProfilePn implements ChartProfilePnInt{
        private String partNumber ;
      private ChartProfile profile ;
       }






Re: URGENT ---> collection NOT RETURNED

Posted by Kishore Talagadadeevi <ta...@us.ibm.com>.
The actual problem I noticed here is :   A profile can have collection of 
part numbers .
I created a profile p1 with part number 1234. 
Again I created a profile p2 with part number with 1234.

I am able to see only profile p2 with 1234 as part number.
I am getting profile p1 with no part number ..

That means if I use same part number for two different profiles, 
then it is getting part number only for  latest created profile.

Any thoughts would be  highly appreciated








Jakob Braeuchi <jb...@gmx.ch> 
08/12/2004 12:35 PM
Please respond to
"OJB Users List"


To
OJB Users List <oj...@db.apache.org>
cc

Subject
Re: URGENT ---> collection NOT RETURNED






hi kishore,

please try to use p6spy to log your sql-statements.
the 'Parts' collection-descriptor is proxied so it will only be loaded if 
it is 
accessed. btw. is it 'Parts' or 'parts' ?

jakob

Kishore Talagadadeevi schrieb:

>    Env:   OJB 1.0/ ODMG api  on windows/AIX  running Websphere server..
> 
>                                            Dev:     Websphere 
Application 
> Developement Studio ( WASD) with WAS test environment
> 
>                               Integration :      code running on 
dedicated 
> Websphere 4.06 server.
> 
>              Use case scenario :       One user_ profile can have 
multiple 
> partunumbers .So there are two tables  1.User_Profile  with other 
> attributes.
>                                                              2. chart_PN 

> table having profile id attribute pointing to user profile id and part 
> number as primary keys.
> 
>                                    Problem :        The partnumber 
> collection for the user profile is empty while retrieving from db. But 
the 
> data is available in database.
>                                                               One 
> noticeable point here is : This works in Dev env but it is not working 
in 
> integration. I dont know why ..
> 
> Need help on  the following :
>                                                           I would 
> appreciate if some one could throw some light on the following :
> 
>                                                           1. Why it is 
not 
> returning the collection ?
>                                                           2. How do I 
> enable debug information? I set all variables in log4j and ojb files to 
> DEBUG . Still I am not
>                                                               getting 
any 
> debug information in my output console.
> 
>                                                           3. Are there 
any 
> settings of ojb depending on Application server settings ???
> 
> 
> 
>  respository.xml :
> --------------------------------------
> 
> <class-descriptor
>           class="ojb.ChartProfilePn"
>           table="CHART_PN">
>            <field-descriptor
>          name="profileId"
>          column="CHART_PROFILE_ID"
>          jdbc-type="INTEGER"
>          primarykey="true"
>          autoincrement="false"
>          access="anonymous"
>          conversion="ojb.conversion.UniqueIDIntegerFieldConversion"
>       />
> 
>           <field-descriptor
>          name="partNumber"
>          column="PN"
>          jdbc-type="CHAR"
>          primarykey="true"
>          autoincrement="false"
>          conversion="ojb.conversion.TrimmedCharacterFieldConversion"
>       />
> 
>                 <reference-descriptor
>                         name="profile"
>                     class-ref="ojb.ChartProfileImpl"
>                    >
>                         <foreignkey field-ref="profileId"/>
>                 </reference-descriptor>
> 
>                 <!-- Cache on a per request basis -->
>                 <attribute 
>                         attribute-name="cacheClass" 
>  attribute-value="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" 
>                 />
> 
>    </class-descriptor>
> <class-descriptor 
>                 class="ojb.ChartProfileImpl" 
>                 table="USER_CHART_PROFILE">
> 
>                 <field-descriptor
>                         name="id"
>                         column="CHART_PROFILE_ID"
>                         jdbc-type="INTEGER"
>                         primarykey="true"
>                         autoincrement="true"
>                         access="readonly"
> 
> 
conversion="procurement.sqms.server.session.ojb.conversion.UniqueIDIntegerFieldConversion"
>                 />
> <collection-descriptor
>                         name="Parts" 
> 
> 
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareCollection"
>                         element-class-ref="ojb.ChartProfilePn" 
>                         proxy="true"
>                         auto-update="true"
>                         > 
>                         <inverse-foreignkey field-ref="profileId"/> 
>                 </collection-descriptor>
> 
>                 <!-- Cache on a per request basis -->
>                 <attribute 
>                         attribute-name="cacheClass" 
>  attribute-value="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" 
>                 />
> 
>         </class-descriptor>
> class files :
> ------------------
> public interface ChartProfile {
>  String[] getParts();
> }
>  class ChartProfileImpl implements ChartProfile
>    {
>       private List Parts = new ArrayList();
> 
>       public String[] getParts() {
> 
>         ArrayList partList = new ArrayList();
>         Iterator iter = Parts.iterator();
>         while (iter.hasNext()) {
>             ChartProfilePnInt chartpn =
>                 (ChartProfilePnInt) iter.next();
> 
>             partList.add(chartIbmpn.getPartNumber());
>         }
>         return (String[]) partList.toArray(new String[partList.size()]);
> 
>       }
> 
>        public void setParts(String[] p) {
> 
>         ArrayList PartsList = new ArrayList();
>         for (int i = 0; i < p.length; i++) {
>             ChartProfilePn Part = new ChartProfilePn();
>             Part.setPartNumber(p[i]);
>             Part.setProfile(this);
>             if (Part != null) {
> 
>                 PartsList.add(Part);
> 
>             }
> 
>         }
>         this.Parts = new ArrayList(PartsList);
> 
>     }
> 
>    }
> interface ChartProfilePnInt extends Serializable {
> 
>         String getPartNumber();
>         ChartProfile getProfile();
> 
> }
>  class ChartProfilePn implements ChartProfilePnInt{
>         private String partNumber ;
>       private ChartProfile profile ;
>        }
> 
> 
> 
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org



Re: URGENT ---> collection NOT RETURNED

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi kishore,

please try to use p6spy to log your sql-statements.
the 'Parts' collection-descriptor is proxied so it will only be loaded if it is 
accessed. btw. is it 'Parts' or 'parts' ?

jakob

Kishore Talagadadeevi schrieb:

>    Env:   OJB 1.0/ ODMG api  on windows/AIX  running Websphere server..
> 
>                                            Dev:     Websphere Application 
> Developement Studio ( WASD) with WAS test environment
> 
>                               Integration :      code running on dedicated 
> Websphere 4.06 server.
> 
>              Use case scenario :       One user_ profile can have multiple 
> partunumbers .So there are two tables  1.User_Profile  with other 
> attributes.
>                                                              2. chart_PN 
> table having profile id attribute pointing to user profile id and part 
> number as primary keys.
> 
>                                    Problem :        The partnumber 
> collection for the user profile is empty while retrieving from db. But the 
> data is available in database.
>                                                               One 
> noticeable point here is : This works in Dev env but it is not working in 
> integration. I dont know why ..
> 
> Need help on  the following :
>                                                           I would 
> appreciate if some one could throw some light on the following :
> 
>                                                           1. Why it is not 
> returning the collection ?
>                                                           2. How do I 
> enable debug information? I set all variables in log4j and ojb files to 
> DEBUG . Still I am not
>                                                               getting any 
> debug information in my output console.
> 
>                                                           3. Are there any 
> settings of ojb depending on Application server settings ???
> 
>  
>  
>  respository.xml :
> --------------------------------------
> 
> <class-descriptor
>           class="ojb.ChartProfilePn"
>           table="CHART_PN">
>            <field-descriptor
>          name="profileId"
>          column="CHART_PROFILE_ID"
>          jdbc-type="INTEGER"
>          primarykey="true"
>          autoincrement="false"
>          access="anonymous"
>          conversion="ojb.conversion.UniqueIDIntegerFieldConversion"
>       />
>  
>           <field-descriptor
>          name="partNumber"
>          column="PN"
>          jdbc-type="CHAR"
>          primarykey="true"
>          autoincrement="false"
>          conversion="ojb.conversion.TrimmedCharacterFieldConversion"
>       />
>  
>                 <reference-descriptor
>                         name="profile"
>                     class-ref="ojb.ChartProfileImpl"
>                    >
>                         <foreignkey field-ref="profileId"/>
>                 </reference-descriptor>
>  
>                 <!-- Cache on a per request basis -->
>                 <attribute 
>                         attribute-name="cacheClass" 
>  attribute-value="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" 
>                 />
>  
>    </class-descriptor>
> <class-descriptor 
>                 class="ojb.ChartProfileImpl" 
>                 table="USER_CHART_PROFILE">
>  
>                 <field-descriptor
>                         name="id"
>                         column="CHART_PROFILE_ID"
>                         jdbc-type="INTEGER"
>                         primarykey="true"
>                         autoincrement="true"
>                         access="readonly"
>  
> conversion="procurement.sqms.server.session.ojb.conversion.UniqueIDIntegerFieldConversion"
>                 />
> <collection-descriptor
>                         name="Parts" 
>  
> collection-class="org.apache.ojb.broker.util.collections.RemovalAwareCollection"
>                         element-class-ref="ojb.ChartProfilePn" 
>                         proxy="true"
>                         auto-update="true"
>                         > 
>                         <inverse-foreignkey field-ref="profileId"/> 
>                 </collection-descriptor>
>  
>                 <!-- Cache on a per request basis -->
>                 <attribute 
>                         attribute-name="cacheClass" 
>  attribute-value="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" 
>                 />
> 
>         </class-descriptor>
> class files :
> ------------------
> public interface ChartProfile {
>  String[] getParts();
> }
>  class ChartProfileImpl implements ChartProfile
>    {
>       private List Parts = new ArrayList();
> 
>       public String[] getParts() {
> 
>         ArrayList partList = new ArrayList();
>         Iterator iter = Parts.iterator();
>         while (iter.hasNext()) {
>             ChartProfilePnInt chartpn =
>                 (ChartProfilePnInt) iter.next();
> 
>             partList.add(chartIbmpn.getPartNumber());
>         }
>         return (String[]) partList.toArray(new String[partList.size()]);
> 
>       }
> 
>        public void setParts(String[] p) {
> 
>         ArrayList PartsList = new ArrayList();
>         for (int i = 0; i < p.length; i++) {
>             ChartProfilePn Part = new ChartProfilePn();
>             Part.setPartNumber(p[i]);
>             Part.setProfile(this);
>             if (Part != null) {
> 
>                 PartsList.add(Part);
> 
>             }
> 
>         }
>         this.Parts = new ArrayList(PartsList);
> 
>     }
> 
>    }
> interface ChartProfilePnInt extends Serializable {
>  
>         String getPartNumber();
>         ChartProfile getProfile();
> 
> }
>  class ChartProfilePn implements ChartProfilePnInt{
>         private String partNumber ;
>       private ChartProfile profile ;
>        }
> 
> 
> 
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org