Return-Path: Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 68733 invoked by uid 500); 18 Jul 2003 08:51:14 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 68659 invoked from network); 18 Jul 2003 08:51:13 -0000 Received: from main.gmane.org (80.91.224.249) by daedalus.apache.org with SMTP; 18 Jul 2003 08:51:13 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19dQwX-0002c6-00 for ; Fri, 18 Jul 2003 10:50:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: ojb-dev@db.apache.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19dQjh-0001c8-00 for ; Fri, 18 Jul 2003 10:37:05 +0200 From: Marko Lahma Subject: NullPointerException in getExtent if no Transaction is started Date: Fri, 18 Jul 2003 11:37:04 +0300 Lines: 23 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@main.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030529 X-Accept-Language: en-us, en Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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