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 13199D1CD for ; Tue, 19 Feb 2013 23:08:42 +0000 (UTC) Received: (qmail 83722 invoked by uid 500); 19 Feb 2013 23:08:41 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 83676 invoked by uid 500); 19 Feb 2013 23:08:41 -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 83663 invoked by uid 99); 19 Feb 2013 23:08:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 23:08:41 +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.173 as permitted sender) Received: from [209.85.214.173] (HELO mail-ob0-f173.google.com) (209.85.214.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 23:08:34 +0000 Received: by mail-ob0-f173.google.com with SMTP id dn14so7203839obc.18 for ; Tue, 19 Feb 2013 15:08:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=EeLx7vps/54Zm1NBzzBXTQbT5YwFJU8DW20t5nCrmto=; b=yC5cDEEbAYi+zydKU2lGUBmPms+Kt8QA8AeDY3Yr0SRb48op9tgHwBX7Tgff3E7MdK 4go9Ub6F16G8STq7GJFFYIYGZuWBQmFMlBGUg9YrakrJLDtEOy3mCSNmFCBTpcmvLdIk rbaFcSekV/BXFbnNcrAALb3VUln/gS5V/F+l/1aEAbdokalTs+W4BBcPkXGKHUttSnQC 2Ixd/8UYgjkeffTTDXhUHfmGWhiz3li+Snd4tYPdUxOaSMwzn8POnwbzR7yM/iWCXnkT qrS2+WSyZTLa31jGhMMVM5j/iLiOLjG32HME5rP/+2Y9DdjW3XZIhsxZN+cDm+jh3vji cuCQ== MIME-Version: 1.0 X-Received: by 10.182.43.103 with SMTP id v7mr8271064obl.17.1361315293484; Tue, 19 Feb 2013 15:08:13 -0800 (PST) Received: by 10.182.144.194 with HTTP; Tue, 19 Feb 2013 15:08:13 -0800 (PST) Date: Wed, 20 Feb 2013 00:08:13 +0100 Message-ID: Subject: my fist openjpa porject / problem. help me please From: Aitor Iturriondobeitia To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=f46d044794f37ed7dd04d61beaae X-Virus-Checked: Checked by ClamAV on apache.org --f46d044794f37ed7dd04d61beaae Content-Type: text/plain; charset=ISO-8859-1 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{ 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 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 --f46d044794f37ed7dd04d61beaae--