Return-Path: Delivered-To: apmail-openejb-users-archive@www.apache.org Received: (qmail 62501 invoked from network); 16 Oct 2007 19:57:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Oct 2007 19:57:48 -0000 Received: (qmail 6375 invoked by uid 500); 16 Oct 2007 19:57:36 -0000 Delivered-To: apmail-openejb-users-archive@openejb.apache.org Received: (qmail 6178 invoked by uid 500); 16 Oct 2007 19:57:35 -0000 Mailing-List: contact users-help@openejb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openejb.apache.org Delivered-To: mailing list users@openejb.apache.org Received: (qmail 6169 invoked by uid 99); 16 Oct 2007 19:57:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Oct 2007 12:57:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of eljotpl@gmail.com designates 64.233.162.229 as permitted sender) Received: from [64.233.162.229] (HELO nz-out-0506.google.com) (64.233.162.229) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Oct 2007 19:57:36 +0000 Received: by nz-out-0506.google.com with SMTP id k1so1303013nzf for ; Tue, 16 Oct 2007 12:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=+LrA1BHrYn+93b292GwIRYYAmfP/HRKoYyVQBWLrm24=; b=ecRqYRvU3HITuDQnFwszLHOmY0HXXs19prGnZi53+a7tc3EEVLh459X+rrfgQyz8EhPepfCnHp+YMW9AgfrDUSewt5yuicEVpfHMV5TBKmOk7k1AlkEG0t9kOP9mQ7dRZvkA8LxnQ5yhALu0Dx+w22cYCrFv4E90awbIL2s7Wbo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=R83DGF9Lo6jC9POAr5zlpopTbtZOgKBsk395vqWVUDicA6R0CDaLmWEjJdbNyGP+x0IgBnL5qCZwzdtuSJtiiPmVsuC/hmW0YHU72/euP4vryJ+STXD0DgB2RBvTWbgVo6KzIugUBIApKmtE3GddOtlwm1njqN4XWlmAwVsK0qA= Received: by 10.115.60.1 with SMTP id n1mr8878909wak.1192564634538; Tue, 16 Oct 2007 12:57:14 -0700 (PDT) Received: by 10.114.199.10 with HTTP; Tue, 16 Oct 2007 12:57:14 -0700 (PDT) Message-ID: <1b5bfeb50710161257p40c83c0bie4a6e19d2d325df6@mail.gmail.com> Date: Tue, 16 Oct 2007 21:57:14 +0200 From: "Jacek Laskowski" Reply-To: jacek@laskowski.net.pl Sender: eljotpl@gmail.com To: users@openejb.apache.org Subject: Re: OpenEJB and Hibernate In-Reply-To: <1192546284.7394.7.camel@moto> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1192182089.6781.4.camel@moto> <59ABC5E4-834C-4EF1-9449-6530F14521E3@iq80.com> <1192439202.7149.3.camel@moto> <1192546284.7394.7.camel@moto> X-Google-Sender-Auth: 839bfda100e4e9d3 X-Virus-Checked: Checked by ClamAV on apache.org On 10/16/07, Martin Vysny wrote: > Okay, it's java:comp/TransactionManager from within a bean, or > java:openejb/TransactionManager from outside a bean ;) We are using > Hibernate via the JPA interface as follows: > > package com.whitestein.fe.impl.config; > > import org.hibernate.transaction.JNDITransactionManagerLookup; > > /** > * Hibernate Transaction manager lookup strategy for OpenEJB. > * > * @author mvy > */ > public class OpenEJBTransactionManagerLookup extends > JNDITransactionManagerLookup { > > @Override > protected String getName() { > return "java:comp/TransactionManager"; //$NON-NLS-1$ > } > > public String getUserTransactionName() { > return "java:comp/UserTransaction"; //$NON-NLS-1$ > } > > } > > > properties.put(Environment.DIALECT, dbDialect); > properties.put(Environment.TRANSACTION_MANAGER_STRATEGY, > OpenEJBTransactionManagerLookup.class.getName()); > properties.put(Environment.TRANSACTION_STRATEGY, > CMTTransactionFactory.class.getName()); > properties.put(Environment.JNDI_CLASS, > "org.apache.openejb.client.LocalInitialContextFactory"); > entityManagerFactory = Persistence.createEntityManagerFactory( > persistenceUnitName, properties); > > This way, Hibernate joins the container transactions. Awesome. I wouldn't imagine such stuff is possible in/with OpenEJB. Even after so long with openejb I can learn new stuff. It'd be great if you could share the app or better yet write a doc how to work with hibernate and openejb together. Would you mind? ;-) Jacek -- Jacek Laskowski http://www.JacekLaskowski.pl