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 CF319ED9B for ; Wed, 20 Feb 2013 07:50:55 +0000 (UTC) Received: (qmail 3685 invoked by uid 500); 20 Feb 2013 07:50:55 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 3462 invoked by uid 500); 20 Feb 2013 07:50:54 -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 3379 invoked by uid 99); 20 Feb 2013 07:50:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2013 07:50:51 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of laudio.info@gmail.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2013 07:50:44 +0000 Received: by mail-ob0-f175.google.com with SMTP id uz6so7349254obc.20 for ; Tue, 19 Feb 2013 23:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=mfJhXjMZhWkrzInCb0zrgoKPrT71ukn8dOGk/v2NQ3Q=; b=FZQOhAdJj3EM5sni5ZbKtuzQmphhLyc7dneEzriczKonY92hk1YVolVIPzb1Z9Mssc fRNxTva1z5uZZ/bsezb0wPCVpGfxeh5Z5DD0nS66P74zc1iP9IDACOYhZGrIFwfFh38D Pqo/TJUrfrGlBtSC5JU4hcu9AnZwmSYL+SwIYVgPMXNzVVjVyxZt7ijZbGiSjCDDRaWu 1bKLTyKwoM2WOgyVHinV+gQDEtyxcHVqKKe+g2Q46XxGsJ+3scuUMbKSPnzpJDFV+ILL 9quHGd0Ek7fiO/7Vwk6Igp+P5bVRFBXhrHsLIU7EO4lg/kgmJjcCD8uOjbEgz7mE9LqX 6rfg== MIME-Version: 1.0 X-Received: by 10.182.123.49 with SMTP id lx17mr8814578obb.63.1361346623669; Tue, 19 Feb 2013 23:50:23 -0800 (PST) Received: by 10.182.144.194 with HTTP; Tue, 19 Feb 2013 23:50:23 -0800 (PST) In-Reply-To: References: Date: Wed, 20 Feb 2013 08:50:23 +0100 Message-ID: Subject: Re: my fist openjpa porject / problem. help me please From: Aitor Iturriondobeitia To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=f46d0444eeffeb872f04d623358c X-Virus-Checked: Checked by ClamAV on apache.org --f46d0444eeffeb872f04d623358c Content-Type: text/plain; charset=ISO-8859-1 this: public void persist(E entity) { entityManager.persist(entity); ** this line } thanks for your answer 2013/2/20 Rick Curtis > What is at com.caf.db.dao.JpaDao.persist(JpaDao.java:20)? > > > On Tue, Feb 19, 2013 at 5:08 PM, Aitor Iturriondobeitia < > laudio.info@gmail.com> wrote: > > > hello > > i an tring to build my firts openjpa app > > i am readint this article ( > > http://java.dzone.com/articles/jpa-implementation-patterns) and building > > it > > for this i make this: > > 1.- generic interface: > > public interface IGenericDao { > > void persist(E entity); > > } > > 2.- other interface, my interface. > > public interface IWsSrvTrackRequest extends IGenericDao > Wssrvtrackrequest>{ > > void wsSrvRequestPersist(Wssrvtrackrequest request); > > } > > 3.- generic JPA-DAO: > > public abstract class JpaDao implements IGenericDao { > > protected Class entityClass; > > > > @PersistenceContext > > protected EntityManager entityManager; > > > > public JpaDao() { > > ParameterizedType genericSuperclass = (ParameterizedType) > > getClass().getGenericSuperclass(); > > this.entityClass = (Class) > > genericSuperclass.getActualTypeArguments()[1]; > > } > > public void persist(E entity) { > > entityManager.persist(entity); > > } > > } > > } > > 4.- my jpa-dao implementation (the Wssrvtrackrequest obj is one jpa > object > > (entity)). > > public class JpaWsSrvTrackRequestDaoImpl extends JpaDao > Wssrvtrackrequest> implements IWsSrvTrackRequest { > > public void wsSrvRequestPersist(Wssrvtrackrequest request){ > > entityManager.persist(request); > > } > > } > > i am make one main class: > > public static void main(String[] args) { > > IWsSrvTrackRequest r = new JpaWsSrvTrackRequestDaoImpl(); > > Wssrvtrackrequest v = new Wssrvtrackrequest(); > > v.setWssrvreqIp("la ip"); > > v.setWssrvreqOid("oid"); > > v.setWssrvreqOiduser("oiduser"); > > v.setWssrvreqRequest("la request"); > > r.persist(v); > > } > > > > but it always returns one nullpointerexception. > > Exception in thread "main" java.lang.NullPointerException > > at com.caf.db.dao.JpaDao.persist(JpaDao.java:20) > > at com.caf.db.dao.ll.main(ll.java:20) > > > > Can you help me please? > > > > thanks > > > > > > -- > *Rick Curtis* > --f46d0444eeffeb872f04d623358c--