[Stripes-users] Stripersist.getEntityManager() -- NullPointerException

2010-07-06 Thread Lev
hi, i'm new to stripes and attempting to use stripersist for persistence. i have added stripersist to Extension.packages in web.xml. also, i added a persistence.xml file in META-INF. however, when i try junit testing the DAO layer that i have created, i receive the following:

Re: [Stripes-users] Stripersist.getEntityManager() -- NullPointerException

2010-07-06 Thread Aaron Porter
Hi Lev, Is your persistence.xml in /WEB-INF/classes/META-INF/ or /META-INF/? It should be in /WEB-INF/classes/META-INF/. That is a huge source of confusion in JPA. :-( If you're using Eclipse I recommend creating a source directory named resources and then creating a subdirectory named WEB-INF

Re: [Stripes-users] Stripersist.getEntityManager() -- NullPointerException

2010-07-06 Thread M.C.S.
Hi, Aaron Porter wrote: If you're using Eclipse I recommend creating a source directory named resources and then creating a subdirectory named WEB-INF and placing persistence.xml in there. Surely just a typo, but it surely should be named META-INF. I really hate these standard folder

Re: [Stripes-users] Model Initialization: Action Bean Populate vs. JPA Load

2010-07-06 Thread Nikolaos Giannopoulos
Egon, That is a truly awesome suggestion... it's simple... it leverages encapsulation... it would eliminate unnecessary object creation... . Unfortunately it won't work. I didn't know this previously but discovered that JPA by default obtains the data from the Entity objects via reflection

Re: [Stripes-users] Stripersist.getEntityManager() -- NullPointerException

2010-07-06 Thread Aaron Porter
Oops! Thanks for catching that Marcus! Aaron On 07/06/2010 09:09 AM, M.C.S. wrote: Hi, Aaron Porter wrote: If you're using Eclipse I recommend creating a source directory named resources and then creating a subdirectory named WEB-INF and placing persistence.xml in there.

Re: [Stripes-users] Model Initialization: Action Bean Populate vs. JPA Load

2010-07-06 Thread Oscar Westra van Holthe - Kind
On 06-07-2010 at 12:29, Nikolaos Giannopoulos wrote: Unfortunately it won't work. I didn't know this previously but discovered that JPA by default obtains the data from the Entity objects via reflection NOT via its getters. What this means is that when the object is being persisted the getters

Re: [Stripes-users] Model Initialization: Action Bean Populate vs. JPA Load

2010-07-06 Thread Nikolaos Giannopoulos
Oscar, Your not missing anything. The point of asking the community is to solve a perceived problem through dialogue and discussion. So 2. below is a non-issue - null or not null - whatever is in the DB will be loaded into the object. When the object is not previously persisted was the

Re: [Stripes-users] Model Initialization: Action Bean Populate vs. JPA Load

2010-07-06 Thread Oscar Westra van Holthe - Kind
On 06-07-2010 at 23:40, Nikolaos Giannopoulos wrote: It's unfortunate though that the initialization has to be considered in 2 places i.e. for each attribute to initialize... once in the getter... and then again to ensure the getter is called in the @PrePersist and @PreUpdate method. Also if

Re: [Stripes-users] Stripersist.getEntityManager() -- NullPointerException

2010-07-06 Thread Lev
hi, i moved persistence.xml to src/resources/META-INF. however, the original problem persists -- i receive a NullPointerException on the call: Stripersist.getEntityManager(); further information: i'm getting this exception when executing a Junit test of a DAO class -- i'm not executing web

Re: [Stripes-users] Stripersist.getEntityManager() -- NullPointerException

2010-07-06 Thread Aaron Porter
Lev, The META-INF directory that contains persistence.xml needs to end up at /WEB-INF/classes/META-INF. It looks like the way you've set it up it would be at /WEB-INF/classes/resources/META-INF. What I was proposing was to create a new source folder called resources. In Eclipse you do that by