I am not surprised at having trouble with the code in the static block. The
right place for doing this kind of thing is this_onAfterInit() of the
*Page*, whether it involves a data object or not.

Aby
TeamND

> -----Original Message-----
> From: Damian O'Connor [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 16, 2000 9:22 AM
> To: [EMAIL PROTECTED]
> Subject: [ND] Use of Dataobjects in Static block
> 
> 
> 
> Hi,
> 
> I have a static{} block I want to execute on our project base 
> page to load data
> from our database to a set of hashtables. These I'll then 
> store in global session.
> 
> Unfortunately I get a null pointer when the project loads the 
> first time. It looks 
> like the dataobject isn't known to the project at that point.
> 
> Should I add the code to the this_onAfterInitEvent of the dataobject?
> 
> Any ideas for getting around this?
> 
> Regards
> Damian
> 
> Code:
>    static
>    {          
>       // Method to retrieve or store field display values
>       loadHashTables();
>    }
>    
>    /**
>     * Searches in the DataObject <i>doqFieldDisplay</i> 
> (table field_display)
>     * for the entries for the given project. The resultset is 
> used to create 
>     * the necessary lookup tables for controlling field 
> display on the individual
>     * pages.
>     *
>     * @return A number of Hashtables that contain as 
>     * key the <i>field name</i>,      <i>page name</i> and 
>     * <i>cntry code</> concatentated as the key.       
>     */
>    protected static final synchronized void loadHashTables () 
>    { 
>               CSpLog.send("pgBase", CSpLog.ERROR, "loadHashTables()");
>       boolean locked = true; 
>       String field_name = new String();
>       String page_name = new String();
>       String cntry_code = new String();      
>       try 
>       { 
>          
>          // Check to see if we can access the global session
>                       // Attempt to lock the session while we 
> read from it.
>          while (! (locked = CSpider.lockGlobalSession ())) 
>          { 
>             java.lang.Thread.sleep (new Long("250").longValue()); 
>          }          
>          CSpValue sessionExists = 
> CSpider.getGlobalSessionObject (Constants.getFieldDisplaySession()); 
>                       // Verify if we need to create the 
> session objects
>          if (sessionExists == null) 
>          {         
> 
>                       CSpSelect doqFldDsp = 
> (CSpSelect)CSpider.getDataObject( "doqFieldDisplay" );
> 
> ******************** doqFldDsp is null *******************   
> 

_________________________________________________________________________
To unsubscribe from this mailing list please send an email to:
[EMAIL PROTECTED]
Please remember to use the same email address you subscribed with.

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to