From users-return-11634-apmail-openjpa-users-archive=openjpa.apache.org@openjpa.apache.org Wed Oct 15 09:35:45 2014 Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B409417CD1 for ; Wed, 15 Oct 2014 09:35:45 +0000 (UTC) Received: (qmail 60784 invoked by uid 500); 15 Oct 2014 09:35:45 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 60739 invoked by uid 500); 15 Oct 2014 09:35:45 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 60728 invoked by uid 99); 15 Oct 2014 09:35:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Oct 2014 09:35:45 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [80.12.242.125] (HELO smtp.smtpout.orange.fr) (80.12.242.125) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Oct 2014 09:35:18 +0000 Received: from wwinf1c19 ([10.223.79.63]) by mwinf5d38 with ME id 3MbH1p0161MxbHW03MbHpW; Wed, 15 Oct 2014 11:35:17 +0200 X-ME-Helo: wwinf1c19 X-ME-Auth: Z291ZXNzZWpAb3JhbmdlLmZy X-ME-Date: Wed, 15 Oct 2014 11:35:17 +0200 X-ME-IP: 94.228.180.66 Date: Wed, 15 Oct 2014 11:35:17 +0200 (CEST) From: gouessej@orange.fr Reply-To: gouessej@orange.fr To: users@openjpa.apache.org Message-ID: <452811994.9873.1413365717624.JavaMail.www@wwinf1c19> In-Reply-To: References: <85521605.61469.1413215777134.JavaMail.www@wwinf2217> <365440803.18424.1413223295102.JavaMail.www@wwinf1h16> <1136093232.12987.1413292854847.JavaMail.www@wwinf1g31> <1845552567.19216.1413301187895.JavaMail.www@wwinf1j16> Subject: Re: javax.persistence.EntityListeners is never called MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [94.228.180.66] X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-REPLYTO: |~| X-Virus-Checked: Checked by ClamAV on apache.org Getting rid of this property doesn't solve my problem. My listener: @Singleton public class MultiLangStringEntityListener { @PostLoad @SuppressWarnings("UseSpecificCatch") public void postLoad(Object entity) { An entity: @Entity @EntityListeners({MultiLangStringEntityListener.class}) @Table(name =3D "THEME") @XmlRootElement(name =3D "Theme") @NamedQueries({ @NamedQuery(name =3D "DmTheme.findAll", query =3D "SELECT d FROM DmTheme d"= )}) public class Theme implements Serializable { private static final long serialVersionUID =3D 1L; // @Max(value=3D?) @Min(value=3D?)//if you know range of your decimal field= s consider using these annotations to enforce field validation @Id @Basic(optional =3D false) @GeneratedValue(strategy =3D GenerationType.SEQUENCE, generator =3D "SEQ_TH= EME") @SequenceGenerator(name =3D "SEQ_THEME", sequenceName =3D "SEQ_THEME", allo= cationSize =3D 1) @Column(name =3D "ID") private BigInteger id; @Embedded @AttributeOverrides({ @AttributeOverride(name =3D "id", column =3D @Column(name =3D "DESCR", null= able=3Dfalse)), @AttributeOverride(name =3D "lang", column =3D @Column(insertable =3D false= , updatable =3D false, name =3D "DESCR")), @AttributeOverride(name =3D "text", column =3D @Column(insertable =3D false= , updatable =3D false, name =3D "DESCR")) }) private MultiLangString descr; The embeddable class: @Embeddable public class MultiLangString implements Serializable { private static final long serialVersionUID =3D 1L; private String id; private String lang; private String text; public MultiLangString() { } Some of my entity classes use both @Embedded and @EmbeddedId but not on the= same field. I don't know what is wrong as it still works with Hibernate wh= ereas I try to stay far from its specific features as you can see in this b= ug report: https://hibernate.atlassian.net/browse/HHH-9437 > Message du 14/10/14 17:45 > De : "Rick Curtis"=20 > A : "users" , gouessej@orange.fr > Copie =C3=A0 :=20 > Objet : Re: javax.persistence.EntityListeners is never called >=20 > One thing that jumps out of your p.xml is the openjpa.Multithreaded > property. I suggest you get rid of that property and ensure that you aren= 't > sharing EntityManager's across threads... but I don't think that is relat= ed > to the problem you are currently having. >=20 > Can you post relevant snippets of your Entity? >=20 > On Tue, Oct 14, 2014 at 10:39 AM, wrote: >=20 > > Sorry for the confusion. No I'm not using those callbacks on an Embedda= ble > > but when I switched to OpenJPA, I remember that I had to add the classe= s > > with @Embeddable into persistence.xml whereas it wasn't necessary with > > Hibernate. > > > > The class that uses those callbacks uses the annotation @Singleton, > > removing it doesn't solve my problem. > > > > Please find enclosed the file. > > > > > > > Message du 14/10/14 17:31 > > > De : "Rick Curtis" > > > A : "users" , gouessej@orange.fr > > > Copie =C3=A0 : > > > Objet : Re: javax.persistence.EntityListeners is never called > > > > > > > > 2.4.x is the latest. > > > > > > > If I understand your previous posts, are you using callbacks(@Preload, > > @Postload, etc, etc) on an Embeddable? If that is the case, I'm not sur= e if > > it is suppose to work? Can I have you post some Entity/embeddable snipp= ets > > so we can better understand what you want to do? > > > > > > > Thanks, > > Rick > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Oct 14, 2014 at 8:20 AM, wrote: > > > > > I use OpenJPA 2.4.0. I'm going to try with a more recent version if any= . > > > > > > > > > > > > > > > > > > > > > > Message du 14/10/14 00:14 > > > > De : "Kevin Sutter" > > > > A : users@openjpa.apache.org, gouessej@orange.fr > > > > Copie =C3=A0 : > > > > Objet : Re: javax.persistence.EntityListeners is never called > > > > > > > > Hi, > > > > The complete trace can be turned on via this property in your p.xml= : > > > > > > > > > > > > > > > > Good luck, > > > > Kevin > > > > > > > > > > > > On Mon, Oct 13, 2014 at 1:01 PM, wrote: > > > > > > > > > Hi > > > > > > > > > > I use Apache OpenEJB 4.7.1 (probably OpenJPA 2.2 or 2.3). I have > > looked at > > > > > the logs and I have already done my best to force the persistence= of > > all > > > > > entity classes including those Hibernate was able to discover alo= ne, > > for > > > > > example the class using @Embeddable. As I'm currently not at work= , I > > can't > > > > > post the persistence.xml but I'll do it tomorrow. What should I t= urn > > on to > > > > > get some more trace? Thank you for your help. > > > > > > > > > > > > > > > > > > > > > > > > > > Message du 13/10/14 19:07 > > > > > > De : "Kevin Sutter" > > > > > > A : users@openjpa.apache.org, gouessej@orange.fr > > > > > > Copie =C3=A0 : > > > > > > Objet : Re: javax.persistence.EntityListeners is never called > > > > > > > > > > > > Hi, > > > > > > EntityListeners should work just fine with OpenJPA. What versio= n of > > > > > > OpenJPA are you using? The basic support is documented here: > > > > > > > > > > > > > http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_ove= rview_pc_callbacks > > > > > > > > > > > > Are there any other messages in the logs that indicate an issue= ? > > Have you > > > > > > tried turning on Trace to ensure that normal persistence > > processing is > > > > > > happening? Can you post your p.xml? Like I mentioned, this shou= ld > > all > > > > > > just work. We'll need a bit more context to help figure out the > > problem. > > > > > > > > > > > > Kevin > > > > > > > > > > > > On Mon, Oct 13, 2014 at 10:56 AM, wrote: > > > > > > > > > > > > > Hello > > > > > > > > > > > > > > I use javax.persistence.EntityListeners. The persistent class= es > > of the > > > > > > > entities are correctly added into persistence.xml. My test ca= se > > works > > > > > > > correctly with Hibernate and OpenJPA except that the annotate= d > > methods > > > > > > > (with @PostLoad, @PreUpdate, @PrePersist and @PostRemove) are > > never > > > > > called > > > > > > > by OpenJPA whereas they are called by Hibernate. Am I missing > > anything > > > > > > > obvious? Best regards. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Rick Curtis > > > > > >=20 >=20 >=20 > --=20 > *Rick Curtis* >