Return-Path: X-Original-To: apmail-deltaspike-users-archive@www.apache.org Delivered-To: apmail-deltaspike-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2635518FF5 for ; Mon, 18 Jan 2016 02:09:16 +0000 (UTC) Received: (qmail 55824 invoked by uid 500); 18 Jan 2016 02:09:16 -0000 Delivered-To: apmail-deltaspike-users-archive@deltaspike.apache.org Received: (qmail 55787 invoked by uid 500); 18 Jan 2016 02:09:16 -0000 Mailing-List: contact users-help@deltaspike.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@deltaspike.apache.org Delivered-To: mailing list users@deltaspike.apache.org Received: (qmail 55752 invoked by uid 99); 18 Jan 2016 02:09:15 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jan 2016 02:09:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 54CD018052F for ; Mon, 18 Jan 2016 02:09:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.898 X-Spam-Level: ** X-Spam-Status: No, score=2.898 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id HycCm6gQUum8 for ; Mon, 18 Jan 2016 02:09:14 +0000 (UTC) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id CE52320F86 for ; Mon, 18 Jan 2016 02:09:13 +0000 (UTC) Received: by mail-io0-f180.google.com with SMTP id 77so504747939ioc.2 for ; Sun, 17 Jan 2016 18:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=ipI5SKJONZkje+QsrZ0Nh618kE1M2zRHbrVIG/o4wNk=; b=uLnoNpKsCVg4h9xbyAeAD5nGuU9e05HzrDa2ysWd0Fcp/7w77sFzqymDBvwEiQV43M yADI+Xm0+jSIewMvwve7Ta9Uo5pwsYBzrzguI3PR5Eba/awZdVbWqsli64NdJ1fGHjas O6mgnNS4cNSKIWW/NCWjy3gMfwMt6qgpAlFW5aU2gygmQ44HG/DgDwblJkauQL/MPRLa +B1uthoh4ghBqO58RC1Wzolp8KT0BJy+tuRkU4Z+2UFFgnWzaL0oitfwrnmM7/wv5Etd W4FnhrPfxhKggRyI5JjcXQw/cFY35jsNdgah6j1BMe6qObMAFF+i1jdg0Jquu0YkyRcR 2/Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; bh=ipI5SKJONZkje+QsrZ0Nh618kE1M2zRHbrVIG/o4wNk=; b=iD99WpzcOh6AIQaSmwZ3exITe1Pamqt+dYrVCEwHNZhxm7ArSU7NFvosQ4cASnYnim eUd8b91e/6TBy2oa7qF/sYsCjYfEYaAGFRvXKX9DGnN1GnTwavwmRr9Mlo5Qf0W3UD5K siXQFsMtr1mN5ZTX0Wz6itH+U/ujE7T2WBkeU/DmtIKrVq95hAlfT7kuAFKDwOVlDZ/r WdOXRTfiELKmAq7hybVD0LhRtC5BYXpG16K3Y5KKiLAVzzTDYb9ScyuPkrkGTaJfjPmN mkIsaLCXZ8HTdI8GiQQ2tU3u9CZbrH5kIyZa71wwFPrxkU8y4+d44X3AsRmOs/bxcf+3 lYHw== X-Gm-Message-State: ALoCoQn5GFlk78BqCvhLNbYZf9ma163EsoqJRuwEnisksRI+5BMIDqWssc40tjjTXmzoisskKlT/pT/OUpKQXR6lCjHbaqLCOA== X-Received: by 10.107.137.67 with SMTP id l64mr20564223iod.102.1453082953229; Sun, 17 Jan 2016 18:09:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Alex Roytman Date: Mon, 18 Jan 2016 02:09:03 +0000 Message-ID: Subject: Re: Transactional with extended EntityManager is not working? To: users@deltaspike.apache.org Content-Type: multipart/alternative; boundary=001a113ed1f841aa8d0529923d57 --001a113ed1f841aa8d0529923d57 Content-Type: text/plain; charset=UTF-8 Hello Gerhard, thank you for the reference. I've read it but my problem is right here as described in this article: As you see the usage is the same. You *do not* have to use ExtendedEntityManager at the injection point. It is just needed in the producer-method: I do need to use not only my own implementation of EntityManager but also my own interface extending EntityManager and when II use it, transactional interceptor does not seem to recognize it the reason I need to extend EntityManager interface is that I need to access few of my own methods on it and when injecting it I can't get to them in the implementation class via field injected as EntityManager (it is proxied and only recognizes interface methods and of course there is not way to typecast it) To give you some background on what I am trying to do: I need to gradually transition an application written a while ago using JDO as persistence. It is a pretty sophisticated domain model, several modules with lots of logic baked into it. We do not want to rewrite it at the moment but we want too take advantage of @Transactional semantic and also wrap it into entity manager so we can do access as much of JDO functionality via EntityManager as possible (pretty much majority can be done but for queries) as a way to gradually move to JPA and eventually remove JDO (sad - it was a great spec with some excellent commercial implementations still superior to JPA but unfortunatelly killed and dead) Anyway, I would like to extent EntityManager interface with one method getJdo() while implementing as many EntityManager method to delegate to wrapped JDO PersistenceManager instance. I need getJdo() because we can't quite wrap all JDO functionality and need access to the underlying EntityManager's JDO PersistenceManager instance. Everything works fine except that if I inject @Inject private EntityManager entityManager; into my bean I can't get to getJdo() if I inject it as @Inject private JdoEntityManager entityManager; @Transactional stops working Thanks, Alex On Sun, Jan 17, 2016 at 6:07 PM Gerhard Petracek wrote: > hi alex, > > please have a look at [1]. > > regards, > gerhard > > [1] > > http://deltaspike.apache.org/documentation/jpa.html#ExtendedPersistenceContexts > > > > 2016-01-17 23:44 GMT+01:00 Alex Roytman : > > > It looks like of a bean is injected with a field of type not > EntityManager > > but an interface extending it, transactional annotation does not work. Is > > there any way to have transactional to recognize interfaces that extend > > from EntityManager > > > > Thanks > > Alex > > > --001a113ed1f841aa8d0529923d57--