Hello,

I have got a session bean running using the broker in JBoss, to insert data
into an oracle database. The problem however is that when I use the ODMG
interface, the process completes but does not save the data.

Here is my bean code:

                        System.out.println( "Testing bean insert..." );

                        Context context = new InitialContext();
                        ODMGFactory factory = ( ODMGFactory )
context.lookup( "java:/ojb/defaultODMG" );
                        Implementation odmg = factory.getInstance();
                        String ojbRepository = "repository.xml";
                        Database db = odmg.newDatabase();
                        db.open( ojbRepository, Database.OPEN_READ_WRITE );
                        System.err.println( "Database created" );

                        // make minimol
                        Simple simple = new Simple();
                        simple.setName( "simon" );

                        Transaction tx = odmg.currentTransaction();
                        System.err.println( "got transaction" );
                        tx.lock( simple, Transaction.WRITE );

                        System.err.println( "closing db" );
                        db.close();
                        System.err.println( "db closed" );

                        System.out.println( "Done." );

is this the right thing to do?

--
To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>

Reply via email to