db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marko Lahma <marko.la...@sysforte.fi>
Subject NullPointerException in getExtent if no Transaction is started
Date Fri, 18 Jul 2003 08:37:04 GMT
Hi all!

I've found that code like this:
PersistenceManager manager = factory.getPersistenceManager();
// Transaction tx = manager.currentTransaction();
// tx.begin();
Query query = manager.newQuery(User.class);
// perform query
Collection allUsers = (Collection) query.execute();

throws NPE in getExtent (pBroker is null) if code is commented as above, 
but if the comments are to be removed connection to db is established 
and all works fine.

This puzzled me for long time until I figured this out. When running 
inside J2EE server one should not start own transactions, container 
managed transactions should be used. I haven't tested this yet with 
bean's transaction flag set to REQUIRED but should there at least be 
some better error message than NPE dumb?

Regards,
Marko Lahma



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


Mime
View raw message