Could you post the stack trace.

Armin
----- Original Message -----
From: "Ujwal Oswal" <[EMAIL PROTECTED]>
To: "'OJB Users List'" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 5:49 PM
Subject: RE: OJB- ODMG Help


> My Null Pointer exception is gone after I commented all the AWT code.
> The new problem I am having is It says "File not found" when I execute
the
> query.
>
> How do I check what query is being fired.
>
> tks
> ujwal
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 09, 2002 11:02 AM
> To: OJB Users List
> Subject: Re: OJB- ODMG Help
>
>
> Everything seems OK.
> Try: Open a new database on every method call and close it after use.
> See below.
> This 'strange' behaviour (Charles explain) will be fixed with the next
> version of OJB.
>
> regards,
> Armin
>
> > [org.apache.ojb.odmg.TransactionImpl] WARN: TransactionImpl created
> with
> > null DatabaseImpl.
>
> Transaction found no opened database.
>
> > public class TestOdmg extends Frame implements ActionListener
> > {
> >     private Implementation odmg = null;
> >     private Vector useCases;
> >     private static String databaseName;
> >     private TextArea textarea;
> >     private Button exit;
> >     private MenuBar menubar = null;
> >     private Menu menu = null;
> >     private MenuItem newUser = null;
> >     private MenuItem showUser = null;
> >     private MenuItem exitApp = null;
> >
> > static
> > {
> >         try
> >         {
> >             databaseName =
> >                 ((PersistenceBrokerConfiguration)
> PersistenceBrokerFactory
> >                     .getConfigurator()
> >                     .getConfigurationFor(null))
> >                     .getRepositoryFilename();
> >         }
> >         catch (ConfigurationException e)
> >         {
> >             databaseName = "repository.xml";
> >         }
> >
> > }
> >
> >     public TestOdmg()
> >     {
> >         textarea = new TextArea();
> >         exit = new Button ("Exit");
> >         exit.addActionListener(this);
> >         menubar = new MenuBar();
> >        menu = new Menu("User");
> >        newUser = new MenuItem ("New User");
> >        newUser.addActionListener(this);
> >        showUser = new MenuItem ("Show User");
> >        showUser.addActionListener(this);
> >        exitApp = new MenuItem ("Exit");
> >        exitApp.addActionListener(this);
> >
> >         odmg = OJB.getInstance();
> >         Database db = odmg.newDatabase();
> >         file://open database
> >         try
> >         {
> >             db.open(databaseName, Database.OPEN_READ_WRITE);
> >         }
> >         catch (ODMGException ex)
> >         {
> >             ex.printStackTrace();
> >         }
> >
> > menu.add(newUser);
> > menu.add(showUser);
> > menu.add(exitApp);
> > menubar.add(menu);
> > setMenuBar(menubar);
> > add(textarea,"Center");
> > add(exit, "South");
> >
> >     setSize(400,400);
> >     this.show();
> >     }
> >
> >     public static void main(String[] args)
> >     {
> >         TestOdmg app = new TestOdmg();
> >     }
> >
> >     private void showUsers()
> >     {
> >     User user = null;
> >         System.out.println("Now Running @@@@@@@@@@@");
> >         int total = 0;
> >
> >         try
> >         {
> // open new DB
> ####        Database db = odmg.newDatabase();
>                 db.open(...);
> >              // 1. open a transaction
> >             Transaction tx = odmg.newTransaction();
> >             tx.begin();
> >
> >             // 2. get an OQLQuery object from the ODMG facade
> >             OQLQuery query = odmg.newOQLQuery();
> >
> >             // 3. set the OQL select statement
> >             query.create("select allusers from " +
> User.class.getName());
> >
> >             // 4. perform the query and store the result in a
> persistent
> > Collection
> >             DList allUsers = (DList) query.execute();
> >             tx.commit();
> >
> >             // 5. now iterate over the result to print each product
> >             java.util.Iterator iter = allUsers.iterator();
> >
> >             while (iter.hasNext())
> >             {
> >             total++;
> >             user = (User) iter.next();
> >                 textarea.appendText("User Id : "+user.getUserId()+ "
> User
> > Name "+ user.getUserName ());
> >                 textarea.append("\n");
> >             }
> >
> >             textarea.appendText("Total Users : "+ total);
> >         }
> >         catch (Throwable t)
> >         {
> >             t.printStackTrace();
> >         }
>             finally
>             {
> // close on every call
> ###         db.close();
>             }
>
> >     }
> >
> > public void actionPerformed (ActionEvent ae) {
> > if (ae.getSource() instanceof Button) {
> >       System.exit(0);;
> > }
> > else if (ae.getSource() instanceof MenuItem) {
> > if ("New User".equals(ae.getActionCommand())) {
> > System.out.println ("New User");
> > // AddUser adduser = new AddUser(this,broker);
> > // adduser.show();
> > }
> > else if ("Show User".equals(ae.getActionCommand()))
> > {
> >            showUsers();
> > }
> > else if ("Exit".equals(ae.getActionCommand())) {
> >            System.exit(0);;
> > }
> > }
> > }
> > }
> >
> > Ujwal
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to