You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Hans J. Prueller" <ha...@gmx.net> on 2007/02/23 18:43:24 UTC

RE: TYPO? Howto integrate JPA within EJB2.1 session beans? [architecture]

Patrick,

I'm currently trying your tip with a PersistenceService util class doing
the lookup of a synchronized entity manager. The problem is that your sample
code does not work!

in fact the statement 

final BrokerFactory bf = OpenJPAPersistence.cast(emf);

is the problem. the above "cast" does not return a BrokerFactory instance!

I am using a 2 days old nightly snapshot 0.9.7 build 

Where is the problem? 

Hans

> -----Ursprüngliche Nachricht-----
> Von: Patrick Linskey [mailto:plinskey@bea.com]
> Gesendet: Donnerstag, 22. Februar 2007 23:22
> An: open-jpa-dev@incubator.apache.org
> Betreff: RE: RE: Howto integrate JPA within EJB2.1 session beans?
> [architecture]
> 
> > Unfortunately, that means that we're using a synchronized
> > block during the lookup. If it looks like EM lookup is a
> > scalability issue for your app, do let us know -- it would
> > be pretty straightforward to replace the synchronized block
> > with a concurrent map.
> 
> OK, I got fed up with that synchronized block. OPENJPA-161 tracks the
> issue; I've got a patch that I'll submit once some more eyes look at it.
> 
> -Patrick
> 
> --
> Patrick Linskey
> BEA Systems, Inc.
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
> 
> > -----Original Message-----
> > From: Patrick Linskey [mailto:plinskey@bea.com]
> > Sent: Thursday, February 22, 2007 8:38 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > beans? [architecture]
> >
> > > If I understand it correct, I "just" have to bind the EMF
> > > onserver startup like.
> > >
> > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> >
> > Yep.
> >
> > >         //does the statement below again create a NEW EMF
> > or ist this
> > >         //just a lookup in the jndi-tree? but why is it
> > > called "Create"
> > >         //and not get?
> > >         EntityManagerFactory emf = OpenJPAPersistence
> > >             .createEntityManagerFactory(
> > >                 "your/EMF/JNDI/location", (Context) null);
> >
> > It's just a lookup. I'm not sure why it's called 'create'. Anyone?
> >
> > >         //why do I have to create a new
> > broker/entitymanager this way?
> > >         //is this because I have to "synchronize" the SLSBs
> > > transaction
> > >         //context with the newly created entitymanager?
> >
> > Yes -- our current OpenJPAPersistence EM lookup methods all create new
> > EMs. The broker code will look up one associated with the current
> > transaction, which is what you're looking for.
> >
> > Unfortunately, that means that we're using a synchronized block during
> > the lookup. If it looks like EM lookup is a scalability issue for your
> > app, do let us know -- it would be pretty straightforward to
> > replace the
> > synchronized block with a concurrent map.
> >
> > > So if understand that right I just would have to call
> > >
> > > PersistenceService.getEntitymanager();
> > >
> > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> >
> > Yep.
> >
> > > I really appreciate your help - it's quite complex to integrate
> > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> >
> > Yes -- sorry about that. We should at least be creating
> > better-designed
> > helper methods in OpenJPA to help out with this.
> >
> > One alternative, of course, is to use Spring 2, which does a
> > pretty good
> > job of JPA bootstrapping.
> >
> > -Patrick
> >
> > --
> > Patrick Linskey
> > BEA Systems, Inc.
> >
> > ______________________________________________________________
> > _________
> > Notice:  This email message, together with any attachments,
> > may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated
> > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > legally privileged, and is intended solely for the use of the
> > individual
> > or entity named in this message. If you are not the intended
> > recipient,
> > and have received this message in error, please immediately
> > return this
> > by email and then delete it.
> >
> > > -----Original Message-----
> > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > Sent: Thursday, February 22, 2007 4:36 AM
> > > To: open-jpa-dev@incubator.apache.org;
> > > open-jpa-dev@incubator.apache.org
> > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session
> > > beans? [architecture]
> > >
> > > Patrick,
> > >
> > > thank you for that tip. To be true, I was not aware of
> > > lifecycle related problems between my SLSBs and JPA - thank
> > > you for that hint. As I want to avoid working with
> > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > yet) I would prefer the JNDI-EMF based approach.
> > >
> > > If I understand it correct, I "just" have to bind the EMF
> > > onserver startup like.
> > >
> > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > >
> > > I would be interested what the code for the
> > > PersistenceService class does:
> > >
> > >
> > >         //does the statement below again create a NEW EMF
> > or ist this
> > >         //just a lookup in the jndi-tree? but why is it
> > > called "Create"
> > >         //and not get?
> > >         EntityManagerFactory emf = OpenJPAPersistence
> > >             .createEntityManagerFactory(
> > >                 "your/EMF/JNDI/location", (Context) null);
> > >
> > >         //why do i have to cast the EMF to a brokerfactory now? I
> > >         //would guess the "broker" is something like a more abstract
> > >         //concept of entitymanager(factory)?
> > >
> > >         //why do I have to create a new
> > broker/entitymanager this way?
> > >         //is this because I have to "synchronize" the SLSBs
> > > transaction
> > >         //context with the newly created entitymanager?
> > >
> > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > >         Broker b = bf.newBroker(
> > >         bf.getConfiguration().getConnectionUserName(),
> > >           bf.getConfiguration().getConnectionPassword(),
> > >           true, // the broker is part of a JTA managed tx
> > >           bf.getConfiguration().getConnectionRetainModeConstant(),
> > >           true); // look for an existing Broker on the tx
> > >
> > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > >         broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > >         broker.setDetachedNew(false);
> > >
> > >         return OpenJPAPersistence.toEntityManager(b);
> > >     }
> > >
> > > So if understand that right I just would have to call
> > >
> > > PersistenceService.getEntitymanager();
> > >
> > > in every SLSB method (NOT in ejbCreate) when needed? fine. I
> > > really appreciate your help - it's quite complex to integrate
> > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> > >
> > > regards
> > > Hans
> > >
> > > -------- Original-Nachricht --------
> > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > Von: "Patrick Linskey" <pl...@bea.com>
> > > An: open-jpa-dev@incubator.apache.org
> > > CC:
> > > Betreff: RE: Howto integrate JPA within EJB2.1 session beans?
> > > [architecture]
> > >
> > > > Another common technique is to get an EMF into JNDI, either
> > > by using a
> > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > >
> > > > Are you looking to integrate OpenJPA with your current managed
> > > > transaction? If so, I'd be careful about creating an EM in
> > > ejbCreate(),
> > > > as its lifecycle is related to the life of the SLSB, not to the
> > > > transactional context (the SLSB might be pooled). So, I'd
> > > just try to
> > > > get the EMF into JNDI when the server starts (creating EMFs
> > > is slow).
> > > > Then, you could avoid having to use your own ThreadLocal
> > > work by using
> > > > the internal OpenJPA BrokerFactory APIs:
> > > >
> > > > public class PersistenceService {
> > > >     public static EntityManager getEntityManager() {
> > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > >             .createEntityManagerFactory(
> > > >                 "your/EMF/JNDI/location", (Context) null);
> > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > >         Broker b = bf.newBroker(
> > > >             bf.getConfiguration().getConnectionUserName(),
> > > >             bf.getConfiguration().getConnectionPassword(),
> > > >             true, // the broker is part of a JTA managed tx
> > > >
> > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > >             true); // look for an existing Broker on the tx
> > > >
> > > >         // do some JPA configuration setup. Logic stolen from
> > > >         // EntityManagerFactoryImpl.
> > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > >         broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > >         broker.setDetachedNew(false);
> > > >
> > > >         return OpenJPAPersistence.toEntityManager(b);
> > > >     }
> > > > }
> > > >
> > > > Meanwhile, we really should add a couple new OpenJPAPersistence /
> > > > OpenJPAEntityManagerFactory methods to help out with this type of
> > > > bootstrapping.
> > > >
> > > > -Patrick
> > > >
> > > > --
> > > > Patrick Linskey
> > > > BEA Systems, Inc.
> > > >
> > > >
> > > ______________________________________________________________
> > > _________
> > > > Notice:  This email message, together with any attachments,
> > > may contain
> > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > >  affiliated
> > > > entities,  that may be confidential,  proprietary,
> > > copyrighted  and/or
> > > > legally privileged, and is intended solely for the use of
> > > the individual
> > > > or entity named in this message. If you are not the
> > > intended recipient,
> > > > and have received this message in error, please immediately
> > > return this
> > > > by email and then delete it.
> > > >
> > > > > -----Original Message-----
> > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > To: open-jpa-dev@incubator.apache.org
> > > > > Subject: Howto integrate JPA within EJB2.1 session beans?
> > > > > [architecture]
> > > > >
> > > > > Hi together,
> > > > >
> > > > > I'm sorry for bothering you with numerous basic questions
> > > > > regarding OpenJPA and its usage but I have to migrate
> > > > > existing CMP EJBs to migrate within short time to OpenJPA as
> > > > > we're having stability issues with the current CMP engine.
> > > > >
> > > > > One last question I'd like to ask is regarding the
> > > > > recommended architecture of using OpenJPA within EJB2.1
> > > > > Stateless sessino beans:
> > > > >
> > > > > I need to work with persistence i.e. the EntityManager
> > > > > throughout all the session beans methods so my idea is to:
> > > > >
> > > > > - create a EntityManagerFactory in the ejbCreate() method
> > > of the SLSB
> > > > > - and also create the EntityManager itself in the
> > > > > ejbCreeate() method and store it as a member variable
> > of the SLSB
> > > > > - this would allow easy access within the SB's methods by
> > > > > just using the already initialized entity manager varialbe
> > > > > em.createNamedQuery() .. etc. etc.
> > > > > - clean up should be performed in the ejbRemove() method
> > > of the SLSB
> > > > >
> > > > > I think doing so will allow migratino to openJPA with less
> > > > > work than doing the whole lookup procedure in every method
> > > > > separately.
> > > > >
> > > > > what do you think? are there any pitfalls i've overlooked?
> > > > >
> > > > > thank you for your ideas!
> > > > >
> > > > > regards
> > > > > Hans
> > > > > --
> > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > Jetzt GMX ProMail testen:
> > www.gmx.net/de/go/mailfooter/promail-out
> > > > >
> > >
> > > --
> > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out
> > >
> >


RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Pinaki Poddar <pp...@bea.com>.
 > EntityManagerFactory emf =
OpenJPAPersistence.createEntityManagerFactory(EMF_JNDI_LOCATION,
(Context) null);
1. Instead of passing null context, if the same Context instance is
passed on every invocation -- does the behaviour change?
2. If the emf and its underlying brokerfactory bf from two consecutive
invocation are emf1,bf1 and emf2, bf2 then which of the following are
true?
     a) emf1 == emf2  and bf1 == bf2
     b).  emf1 != emf2 but bf1 == bf2
     c).  emf1!=emf2 and bf1!=bf2



Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
Sent: Tuesday, February 27, 2007 10:30 PM
To: open-jpa-dev@incubator.apache.org
Subject: AW: EMF JNDI lookup is starting openJPA every time - was: Howto
integrate JPA within EJB2.1 session beans? 

please see below. The method PersistenceService.getEntityManager() is
invoked directly in SLSB's methods if access to the EM is needed, so
there could be multiple invocations within a single transaction spanning
multiple SLSB methods.

hth,
Hans

public class PersistenceService {
	private static final Logger logger =
Logger.getLogger(PersistenceService.class.getName());
	
	public static final String EMF_JNDI_LOCATION =
"your/EMF/JNDI/location";

	public static EntityManager getEntityManager() {
		
		logger.log(Level.FINEST, "creating a fresh, clean
EntityManager from JNDI EMF.");
		
		EntityManagerFactory emf = OpenJPAPersistence
	
.createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);

		final BrokerFactory bf =
OpenJPAPersistence.toBrokerFactory(emf);

		final Broker b = bf.newBroker(bf.getConfiguration()
				.getConnectionUserName(),
bf.getConfiguration()
				.getConnectionPassword(), true,
bf.getConfiguration().getConnectionRetainModeConstant(), true); 
		// do some JPA configuration setup. Logic stolen from 
		// EntityManagerFactoryImpl.
		b.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
		b.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
		b.setDetachedNew(false);

		return OpenJPAPersistence.toEntityManager(b);

			}
}



_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

AW: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by "Hans J. Prueller" <ha...@gmx.net>.
please see below. The method PersistenceService.getEntityManager() is
invoked directly in SLSB's methods if access to the EM is needed, so there
could be multiple invocations within a single transaction spanning multiple
SLSB methods.

hth,
Hans

public class PersistenceService {
	private static final Logger logger =
Logger.getLogger(PersistenceService.class.getName());
	
	public static final String EMF_JNDI_LOCATION =
"your/EMF/JNDI/location";

	public static EntityManager getEntityManager() {
		
		logger.log(Level.FINEST, "creating a fresh, clean
EntityManager from JNDI EMF.");
		
		EntityManagerFactory emf = OpenJPAPersistence
	
.createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);

		final BrokerFactory bf =
OpenJPAPersistence.toBrokerFactory(emf);

		final Broker b = bf.newBroker(bf.getConfiguration()
				.getConnectionUserName(),
bf.getConfiguration()
				.getConnectionPassword(), true,
bf.getConfiguration().getConnectionRetainModeConstant(), true); 
		// do some JPA configuration setup. Logic stolen from 
		// EntityManagerFactoryImpl.
		b.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
		b.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
		b.setDetachedNew(false);

		return OpenJPAPersistence.toEntityManager(b);

			}
}



> -----Ursprüngliche Nachricht-----
> Von: Patrick Linskey [mailto:plinskey@bea.com]
> Gesendet: Mittwoch, 28. Februar 2007 06:56
> An: open-jpa-dev@incubator.apache.org
> Betreff: RE: EMF JNDI lookup is starting openJPA every time - was: Howto
> integrate JPA within EJB2.1 session beans?
> 
> If you could send the source for PersistenceService, and details about how
> you invoke it if the method takes any arguments, that would be very
> useful.
> 
> -Patrick
> 
> --
> Patrick Linskey
> BEA Systems, Inc.
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
> 
> > -----Original Message-----
> > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > Sent: Tuesday, February 27, 2007 9:44 PM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: AW: EMF JNDI lookup is starting openJPA every time -
> > was: Howto integrate JPA within EJB2.1 session beans?
> >
> > >> -The name used for the lookup is defined to return an
> > instance of the
> > >> object that might be shared. The name java:comp/ORB is such a name.
> >
> > does this mean that the name/key with which the EMF is bound into JNDI
> > affects the sharing/non-sharing of the bound instance?
> >
> > currently the JNDI-string our test-implementation definitely does not
> > comply to any conventions (it's not like "java:comp/.." it's
> > rather some
> > tests string like "here/comes/thejndi/name") - could that be
> > the problem in
> > our case?
> >
> > I'm not sure if I followed the whole discussion completely
> > ... It seems
> > that you might have found another reason for the behaviour?
> > Is this clear
> > already or is it still required to send more detailed stuff
> > from our side?
> >
> > regards,
> > hans
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Pinaki Poddar [mailto:ppoddar@bea.com]
> > > Gesendet: Dienstag, 27. Februar 2007 18:48
> > > An: open-jpa-dev@incubator.apache.org
> > > Betreff: RE: EMF JNDI lookup is starting openJPA every time
> > - was: Howto
> > > integrate JPA within EJB2.1 session beans?
> > >
> > >  > But maybe something funky is happening with JNDI serializing the
> > > factory and then deserializing it or something.
> > >
> > > >From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and Directory
> > > Interface:
> > >
> > > In general, lookups of objects in the JNDI java: namespace
> > are required to
> > > return a new instance of the requested object every time.
> > Exceptions are
> > > allowed for the following:
> > > - The container knows the object is immutable (for example,
> > objects of
> > > type java.lang.String), or knows that the application can't
> > change the
> > > state of
> > > the object.
> > > -The object is defined to be a singleton, such that only
> > one instance of
> > > the object may exist in the JVM.
> > > -The name used for the lookup is defined to return an
> > instance of the
> > > object that might be shared. The name java:comp/ORB is such a name.
> > >
> > > In these cases, a shared instance of the object may be
> > returned. In all
> > > other cases, a new instance of the requested object must be
> > returned on
> > > each
> > > lookup.
> > >
> > >
> > > Pinaki Poddar
> > > BEA Systems
> > > 415.402.7317
> > >
> > >
> > > -----Original Message-----
> > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > Sent: Monday, February 26, 2007 11:11 PM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: RE: EMF JNDI lookup is starting openJPA every time
> > - was: Howto
> > > integrate JPA within EJB2.1 session beans?
> > >
> > > It should be going through the following code:
> > >
> > >     public static OpenJPAEntityManagerFactory
> > createEntityManagerFactory
> > >         (String jndiLocation, Context context) {
> > >         if (jndiLocation == null)
> > >             throw new NullPointerException("jndiLocation == null");
> > >
> > >         try {
> > >             if (context == null)
> > >                 context = new InitialContext();
> > >
> > >             Object o = context.lookup(jndiLocation);
> > >             return (OpenJPAEntityManagerFactory)
> > > PortableRemoteObject.narrow(o,
> > >                 OpenJPAEntityManagerFactory.class);
> > >         } catch (NamingException ne) {
> > >             throw new ArgumentException(_loc.get("naming-exception",
> > >                 jndiLocation), new Throwable[]{ ne }, null, true);
> > >         }
> > >     }
> > >
> > > I don't see anything in there that would be causing a
> > creation to happen.
> > > But maybe something funky is happening with JNDI
> > serializing the factory
> > > and then deserializing it or something.
> > >
> > > Do you have any means of getting a stack from where the creation is
> > > happening? It'd be great to get a bit more context about
> > what's going on.
> > >
> > > -Patrick
> > >
> > > --
> > > Patrick Linskey
> > > BEA Systems, Inc.
> > >
> > >
> > ______________________________________________________________
> > _________
> > > Notice:  This email message, together with any attachments,
> > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >  affiliated
> > > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of
> > the individual
> > > or entity named in this message. If you are not the
> > intended recipient,
> > > and have received this message in error, please immediately
> > return this by
> > > email and then delete it.
> > >
> > > > -----Original Message-----
> > > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > > Sent: Saturday, February 24, 2007 10:36 PM
> > > > To: open-jpa-dev@incubator.apache.org
> > > > Subject: EMF JNDI lookup is starting openJPA every time -
> > > > was: Howto integrate JPA within EJB2.1 session beans?
> > > >
> > > > Hi together, Patrick,
> > > >
> > > > the code you suggested for doing a helper method that
> > deals with the
> > > > EMF JNDI lookup and the EM creating within our J2EE1.4
> > app basically
> > > > works fine, but as you perhaps may remember I asked why
> > the method is
> > > > called "create":
> > > >
> > > > EntityManagerFactory myemf =
> > > > OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> > > > (Context)null);
> > > >
> > > > It seems that the method above really creates a NEW EMF on every
> > > > invocation!
> > > > I checked the logs of my application and I see the
> > following messages
> > > > on every invocation of my PersistenceService.getEntityManger()
> > > > method (which
> > > > does the above lookup and some more ..)
> > > >
> > > > 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
> > > > : creating a
> > > > fresh
> > > > , clean EntityManager from JNDI EMF.
> > > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > > openjpa.Runtime -
> > > > Starti
> > > > ng OpenJPA 0.9.7-incubating-SNAPSHOT
> > > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > > openjpa.jdbc.JDBC -
> > > > Open
> > > > JPA will now connect to the database to attempt to
> > determine what type
> > > > of databa se dictionary to use.  To prevent this connection in the
> > > > future, set your openjp a.jdbc.DBDictionary configuration
> > property to
> > > > the appropriate value for your dat abase (see the
> > documentation for
> > > > available values).
> > > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > > openjpa.jdbc.JDBC -
> > > > Usin
> > > > g dictionary class
> > > > "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c
> > > > ommunity-nt ,MySQL-AB JDBC Driver
> > mysql-connector-java-5.0.4 ( $Date:
> > > > 2006-10-19
> > > >  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> > > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > > openjpa.MetaData -
> > > > Found
> > > >  1 classes with metadata in 0 milliseconds.
> > > >
> > > >
> > > > It seems that OpenJPA is now bootstrapping everytime I
> > access it. I am
> > > > binding the EMF somewhen at bootstrapping time with
> > > >
> > > > final EntityManagerFactory emFactory = Persistence
> > > >
.createEntityManagerFactory("lbsims");
> > > >
> > > > Context ictx = new InitialContext();
> > > > ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> > > >
> > > > The lookup uses the same constants, so the EMF in JNDI should be
> > > > found?
> > > >
> > > > EntityManagerFactory emf = OpenJPAPersistence
> > > >
> > > > .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> > > >
> > > > Any Idea what could be wrong here?
> > > >
> > > > regards,
> > > > HANS
> > > >
> > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > Gesendet: Freitag, 23. Februar 2007 18:46
> > > > > An: open-jpa-dev@incubator.apache.org
> > > > > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1
> > session beans?
> > > > > [architecture]
> > > > >
> > > > > Typo indeed. It should be
> > > > OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > > > > about that.
> > > > >
> > > > > -Patrick
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > BEA Systems, Inc.
> > > > >
> > > > >
> > > > ______________________________________________________________
> > > > _________
> > > > > Notice:  This email message, together with any attachments,
> > > > may contain
> > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > >  affiliated
> > > > > entities,  that may be confidential,  proprietary,
> > > > copyrighted  and/or
> > > > > legally privileged, and is intended solely for the use of
> > > > the individual
> > > > > or entity named in this message. If you are not the
> > > > intended recipient,
> > > > > and have received this message in error, please immediately
> > > > return this
> > > > > by email and then delete it.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > > > > Sent: Friday, February 23, 2007 9:43 AM
> > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > > > > > beans? [architecture]
> > > > > >
> > > > > > Patrick,
> > > > > >
> > > > > > I'm currently trying your tip with a
> > PersistenceService util class
> > > > > > doing the lookup of a synchronized entity manager.
> > The problem is
> > > > > > that your sample code does not work!
> > > > > >
> > > > > > in fact the statement
> > > > > >
> > > > > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > >
> > > > > > is the problem. the above "cast" does not return a
> > BrokerFactory
> > > > > > instance!
> > > > > >
> > > > > > I am using a 2 days old nightly snapshot 0.9.7 build
> > > > > >
> > > > > > Where is the problem?
> > > > > >
> > > > > > Hans
> > > > > >
> > > > > > > -----Ursprüngliche Nachricht-----
> > > > > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1
> > > > session beans?
> > > > > > > [architecture]
> > > > > > >
> > > > > > > > Unfortunately, that means that we're using a synchronized
> > > > > > > > block during the lookup. If it looks like EM lookup is a
> > > > > > > > scalability issue for your app, do let us know --
> > it would be
> > > > > > > > pretty straightforward to replace the
> > synchronized block with
> > > > > > > > a concurrent map.
> > > > > > >
> > > > > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > > > > tracks the
> > > > > > > issue; I've got a patch that I'll submit once some more
> > > > > > eyes look at it.
> > > > > > >
> > > > > > > -Patrick
> > > > > > >
> > > > > > > --
> > > > > > > Patrick Linskey
> > > > > > > BEA Systems, Inc.
> > > > > > >
> > > > > > >
> > > > > > ______________________________________________________________
> > > > > > _________
> > > > > > > Notice:  This email message, together with any attachments,
> > > > > > may contain
> > > > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > > >  affiliated
> > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > copyrighted  and/or
> > > > > > > legally privileged, and is intended solely for the use of
> > > > > > the individual
> > > > > > > or entity named in this message. If you are not the
> > > > > > intended recipient,
> > > > > > > and have received this message in error, please immediately
> > > > > > return this
> > > > > > > by email and then delete it.
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > > > > > beans? [architecture]
> > > > > > > >
> > > > > > > > > If I understand it correct, I "just" have to
> > bind the EMF
> > > > > > > > > onserver startup like.
> > > > > > > > >
> > > > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > > >
> > > > > > > > Yep.
> > > > > > > >
> > > > > > > > >         //does the statement below again create
> > a NEW EMF
> > > > > > > > or ist this
> > > > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > > > called "Create"
> > > > > > > > >         //and not get?
> > > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > > >             .createEntityManagerFactory(
> > > > > > > > >                 "your/EMF/JNDI/location",
> > (Context) null);
> > > > > > > >
> > > > > > > > It's just a lookup. I'm not sure why it's called
> > > > 'create'. Anyone?
> > > > > > > >
> > > > > > > > >         //why do I have to create a new
> > > > > > > > broker/entitymanager this way?
> > > > > > > > >         //is this because I have to
> > "synchronize" the SLSBs
> > > > > > > > > transaction
> > > > > > > > >         //context with the newly created entitymanager?
> > > > > > > >
> > > > > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > > > > all create new
> > > > > > > > EMs. The broker code will look up one associated with
> > > > the current
> > > > > > > > transaction, which is what you're looking for.
> > > > > > > >
> > > > > > > > Unfortunately, that means that we're using a synchronized
> > > > > > block during
> > > > > > > > the lookup. If it looks like EM lookup is a scalability
> > > > > > issue for your
> > > > > > > > app, do let us know -- it would be pretty
> > straightforward to
> > > > > > > > replace the synchronized block with a concurrent map.
> > > > > > > >
> > > > > > > > > So if understand that right I just would have to call
> > > > > > > > >
> > > > > > > > > PersistenceService.getEntitymanager();
> > > > > > > > >
> > > > > > > > > in every SLSB method (NOT in ejbCreate) when
> > needed? fine.
> > > > > > > >
> > > > > > > > Yep.
> > > > > > > >
> > > > > > > > > I really appreciate your help - it's quite complex
> > > > to integrate
> > > > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > > > environment.. *puh*
> > > > > > > >
> > > > > > > > Yes -- sorry about that. We should at least be creating
> > > > > > > > better-designed helper methods in OpenJPA to help out with
> > > > > > > > this.
> > > > > > > >
> > > > > > > > One alternative, of course, is to use Spring 2,
> > which does a
> > > > > > > > pretty good job of JPA bootstrapping.
> > > > > > > >
> > > > > > > > -Patrick
> > > > > > > >
> > > > > > > > --
> > > > > > > > Patrick Linskey
> > > > > > > > BEA Systems, Inc.
> > > > > > > >
> > > > > > > >
> > ______________________________________________________________
> > > > > > > > _________
> > > > > > > > Notice:  This email message, together with any
> > attachments,
> > > > > > > > may contain information  of  BEA Systems,  Inc.,  its
> > > > > > > > subsidiaries  and affiliated entities,  that may be
> > > > > > > > confidential,  proprietary, copyrighted  and/or legally
> > > > > > > > privileged, and is intended solely for the use of the
> > > > > > > > individual or entity named in this message. If
> > you are not the
> > > > > > > > intended recipient, and have received this
> > message in error,
> > > > > > > > please immediately return this by email and then
> > delete it.
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > > > > open-jpa-dev@incubator.apache.org
> > > > > > > > > Subject: Re: RE: Howto integrate JPA within
> > EJB2.1 session
> > > > > > > > > beans? [architecture]
> > > > > > > > >
> > > > > > > > > Patrick,
> > > > > > > > >
> > > > > > > > > thank you for that tip. To be true, I was not aware of
> > > > > > > > > lifecycle related problems between my SLSBs and
> > JPA - thank
> > > > > > > > > you for that hint. As I want to avoid working with
> > > > > > > > > ThreadLocal (simply because I didn't work with
> > ThreadLocals
> > > > > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > > > > >
> > > > > > > > > If I understand it correct, I "just" have to
> > bind the EMF
> > > > > > > > > onserver startup like.
> > > > > > > > >
> > > > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > > > >
> > > > > > > > > I would be interested what the code for the
> > > > > > > > > PersistenceService class does:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >         //does the statement below again create
> > a NEW EMF
> > > > > > > > or ist this
> > > > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > > > called "Create"
> > > > > > > > >         //and not get?
> > > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > > >             .createEntityManagerFactory(
> > > > > > > > >                 "your/EMF/JNDI/location",
> > (Context) null);
> > > > > > > > >
> > > > > > > > >         //why do i have to cast the EMF to a
> > > > > > brokerfactory now? I
> > > > > > > > >         //would guess the "broker" is something like a
> > > > > > more abstract
> > > > > > > > >         //concept of entitymanager(factory)?
> > > > > > > > >
> > > > > > > > >         //why do I have to create a new
> > > > > > > > broker/entitymanager this way?
> > > > > > > > >         //is this because I have to
> > "synchronize" the SLSBs
> > > > > > > > > transaction
> > > > > > > > >         //context with the newly created entitymanager?
> > > > > > > > >
> > > > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > > > >         Broker b = bf.newBroker(
> > > > > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > > > > >           true, // the broker is part of a JTA
> > managed tx
> > > > > > > > >
> > > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > > >           true); // look for an existing Broker
> > on the tx
> > > > > > > > >
> > > > > > > > >
> > broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > > >
> > > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > > >         broker.setDetachedNew(false);
> > > > > > > > >
> > > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > > So if understand that right I just would have to call
> > > > > > > > >
> > > > > > > > > PersistenceService.getEntitymanager();
> > > > > > > > >
> > > > > > > > > in every SLSB method (NOT in ejbCreate) when
> > needed? fine. I
> > > > > > > > > really appreciate your help - it's quite complex to
> > > > integrate
> > > > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > > > environment.. *puh*
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > > Hans
> > > > > > > > >
> > > > > > > > > -------- Original-Nachricht --------
> > > > > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > > > > CC:
> > > > > > > > > Betreff: RE: Howto integrate JPA within EJB2.1
> > > > session beans?
> > > > > > > > > [architecture]
> > > > > > > > >
> > > > > > > > > > Another common technique is to get an EMF into
> > > > JNDI, either
> > > > > > > > > by using a
> > > > > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > > > > >
> > > > > > > > > > Are you looking to integrate OpenJPA with your
> > > > current managed
> > > > > > > > > > transaction? If so, I'd be careful about
> > creating an EM in
> > > > > > > > > ejbCreate(),
> > > > > > > > > > as its lifecycle is related to the life of the SLSB,
> > > > > > not to the
> > > > > > > > > > transactional context (the SLSB might be
> > pooled). So, I'd
> > > > > > > > > just try to
> > > > > > > > > > get the EMF into JNDI when the server starts
> > > > (creating EMFs
> > > > > > > > > is slow).
> > > > > > > > > > Then, you could avoid having to use your own
> > ThreadLocal
> > > > > > > > > work by using
> > > > > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > > > > >
> > > > > > > > > > public class PersistenceService {
> > > > > > > > > >     public static EntityManager getEntityManager() {
> > > > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > > > >             .createEntityManagerFactory(
> > > > > > > > > >                 "your/EMF/JNDI/location",
> > (Context) null);
> > > > > > > > > >         BrokerFactory bf =
> > OpenJPAPersistence.cast(emf);
> > > > > > > > > >         Broker b = bf.newBroker(
> > > > > > > > > >
> > bf.getConfiguration().getConnectionUserName(),
> > > > > > > > > >
> > bf.getConfiguration().getConnectionPassword(),
> > > > > > > > > >             true, // the broker is part of a JTA
> > > > managed tx
> > > > > > > > > >
> > > > > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > > > >             true); // look for an existing Broker
> > > > on the tx
> > > > > > > > > >
> > > > > > > > > >         // do some JPA configuration setup. Logic
> > > > stolen from
> > > > > > > > > >         // EntityManagerFactoryImpl.
> > > > > > > > > >
> > > > broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > > > >
> > > > > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > > > >         broker.setDetachedNew(false);
> > > > > > > > > >
> > > > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > > > >     }
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > Meanwhile, we really should add a couple new
> > > > > > OpenJPAPersistence /
> > > > > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > > > > this type of
> > > > > > > > > > bootstrapping.
> > > > > > > > > >
> > > > > > > > > > -Patrick
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > Patrick Linskey
> > > > > > > > > > BEA Systems, Inc.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > ______________________________________________________________
> > > > > > > > > _________
> > > > > > > > > > Notice:  This email message, together with any
> > > > attachments,
> > > > > > > > > may contain
> > > > > > > > > > information  of  BEA Systems,  Inc.,  its
> > > > subsidiaries  and
> > > > > > > > >  affiliated
> > > > > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > > > > copyrighted  and/or
> > > > > > > > > > legally privileged, and is intended solely
> > for the use of
> > > > > > > > > the individual
> > > > > > > > > > or entity named in this message. If you are not the
> > > > > > > > > intended recipient,
> > > > > > > > > > and have received this message in error, please
> > > > immediately
> > > > > > > > > return this
> > > > > > > > > > by email and then delete it.
> > > > > > > > > >
> > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > > > > Subject: Howto integrate JPA within EJB2.1
> > > > session beans?
> > > > > > > > > > > [architecture]
> > > > > > > > > > >
> > > > > > > > > > > Hi together,
> > > > > > > > > > >
> > > > > > > > > > > I'm sorry for bothering you with numerous basic
> > > > questions
> > > > > > > > > > > regarding OpenJPA and its usage but I have
> > to migrate
> > > > > > > > > > > existing CMP EJBs to migrate within short time
> > > > to OpenJPA as
> > > > > > > > > > > we're having stability issues with the current
> > > > CMP engine.
> > > > > > > > > > >
> > > > > > > > > > > One last question I'd like to ask is regarding the
> > > > > > > > > > > recommended architecture of using OpenJPA
> > within EJB2.1
> > > > > > > > > > > Stateless sessino beans:
> > > > > > > > > > >
> > > > > > > > > > > I need to work with persistence i.e. the
> > EntityManager
> > > > > > > > > > > throughout all the session beans methods so my
> > > > idea is to:
> > > > > > > > > > >
> > > > > > > > > > > - create a EntityManagerFactory in the
> > > > ejbCreate() method
> > > > > > > > > of the SLSB
> > > > > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > > > > ejbCreeate() method and store it as a
> > member variable
> > > > > > > > of the SLSB
> > > > > > > > > > > - this would allow easy access within the SB's
> > > > methods by
> > > > > > > > > > > just using the already initialized entity
> > > > manager varialbe
> > > > > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > > > > - clean up should be performed in the
> > ejbRemove() method
> > > > > > > > > of the SLSB
> > > > > > > > > > >
> > > > > > > > > > > I think doing so will allow migratino to
> > > > openJPA with less
> > > > > > > > > > > work than doing the whole lookup procedure in
> > > > every method
> > > > > > > > > > > separately.
> > > > > > > > > > >
> > > > > > > > > > > what do you think? are there any pitfalls i've
> > > > overlooked?
> > > > > > > > > > >
> > > > > > > > > > > thank you for your ideas!
> > > > > > > > > > >
> > > > > > > > > > > regards
> > > > > > > > > > > Hans
> > > > > > > > > > > --
> > > > > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > > > > Jetzt GMX ProMail testen:
> > > > > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > > Jetzt GMX ProMail testen:
> > > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >


RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Patrick Linskey <pl...@bea.com>.
If you could send the source for PersistenceService, and details about how you invoke it if the method takes any arguments, that would be very useful.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> Sent: Tuesday, February 27, 2007 9:44 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: AW: EMF JNDI lookup is starting openJPA every time - 
> was: Howto integrate JPA within EJB2.1 session beans? 
> 
> >> -The name used for the lookup is defined to return an 
> instance of the 
> >> object that might be shared. The name java:comp/ORB is such a name.
> 
> does this mean that the name/key with which the EMF is bound into JNDI
> affects the sharing/non-sharing of the bound instance?
> 
> currently the JNDI-string our test-implementation definitely does not
> comply to any conventions (it's not like "java:comp/.." it's 
> rather some
> tests string like "here/comes/thejndi/name") - could that be 
> the problem in
> our case?
> 
> I'm not sure if I followed the whole discussion completely 
> ... It seems
> that you might have found another reason for the behaviour? 
> Is this clear
> already or is it still required to send more detailed stuff 
> from our side?
> 
> regards,
> hans
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Pinaki Poddar [mailto:ppoddar@bea.com]
> > Gesendet: Dienstag, 27. Februar 2007 18:48
> > An: open-jpa-dev@incubator.apache.org
> > Betreff: RE: EMF JNDI lookup is starting openJPA every time 
> - was: Howto
> > integrate JPA within EJB2.1 session beans?
> > 
> >  > But maybe something funky is happening with JNDI serializing the
> > factory and then deserializing it or something.
> > 
> > >From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and Directory
> > Interface:
> > 
> > In general, lookups of objects in the JNDI java: namespace 
> are required to
> > return a new instance of the requested object every time. 
> Exceptions are
> > allowed for the following:
> > - The container knows the object is immutable (for example, 
> objects of
> > type java.lang.String), or knows that the application can't 
> change the
> > state of
> > the object.
> > -The object is defined to be a singleton, such that only 
> one instance of
> > the object may exist in the JVM.
> > -The name used for the lookup is defined to return an 
> instance of the
> > object that might be shared. The name java:comp/ORB is such a name.
> > 
> > In these cases, a shared instance of the object may be 
> returned. In all
> > other cases, a new instance of the requested object must be 
> returned on
> > each
> > lookup.
> > 
> > 
> > Pinaki Poddar
> > BEA Systems
> > 415.402.7317
> > 
> > 
> > -----Original Message-----
> > From: Patrick Linskey [mailto:plinskey@bea.com]
> > Sent: Monday, February 26, 2007 11:11 PM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: RE: EMF JNDI lookup is starting openJPA every time 
> - was: Howto
> > integrate JPA within EJB2.1 session beans?
> > 
> > It should be going through the following code:
> > 
> >     public static OpenJPAEntityManagerFactory 
> createEntityManagerFactory
> >         (String jndiLocation, Context context) {
> >         if (jndiLocation == null)
> >             throw new NullPointerException("jndiLocation == null");
> > 
> >         try {
> >             if (context == null)
> >                 context = new InitialContext();
> > 
> >             Object o = context.lookup(jndiLocation);
> >             return (OpenJPAEntityManagerFactory)
> > PortableRemoteObject.narrow(o,
> >                 OpenJPAEntityManagerFactory.class);
> >         } catch (NamingException ne) {
> >             throw new ArgumentException(_loc.get("naming-exception",
> >                 jndiLocation), new Throwable[]{ ne }, null, true);
> >         }
> >     }
> > 
> > I don't see anything in there that would be causing a 
> creation to happen.
> > But maybe something funky is happening with JNDI 
> serializing the factory
> > and then deserializing it or something.
> > 
> > Do you have any means of getting a stack from where the creation is
> > happening? It'd be great to get a bit more context about 
> what's going on.
> > 
> > -Patrick
> > 
> > --
> > Patrick Linskey
> > BEA Systems, Inc.
> > 
> > 
> ______________________________________________________________
> _________
> > Notice:  This email message, together with any attachments, 
> may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and 
>  affiliated
> > entities,  that may be confidential,  proprietary,  
> copyrighted  and/or
> > legally privileged, and is intended solely for the use of 
> the individual
> > or entity named in this message. If you are not the 
> intended recipient,
> > and have received this message in error, please immediately 
> return this by
> > email and then delete it.
> > 
> > > -----Original Message-----
> > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > Sent: Saturday, February 24, 2007 10:36 PM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: EMF JNDI lookup is starting openJPA every time -
> > > was: Howto integrate JPA within EJB2.1 session beans?
> > >
> > > Hi together, Patrick,
> > >
> > > the code you suggested for doing a helper method that 
> deals with the
> > > EMF JNDI lookup and the EM creating within our J2EE1.4 
> app basically
> > > works fine, but as you perhaps may remember I asked why 
> the method is
> > > called "create":
> > >
> > > EntityManagerFactory myemf =
> > > OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> > > (Context)null);
> > >
> > > It seems that the method above really creates a NEW EMF on every
> > > invocation!
> > > I checked the logs of my application and I see the 
> following messages
> > > on every invocation of my PersistenceService.getEntityManger()
> > > method (which
> > > does the above lookup and some more ..)
> > >
> > > 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
> > > : creating a
> > > fresh
> > > , clean EntityManager from JNDI EMF.
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > openjpa.Runtime -
> > > Starti
> > > ng OpenJPA 0.9.7-incubating-SNAPSHOT
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > openjpa.jdbc.JDBC -
> > > Open
> > > JPA will now connect to the database to attempt to 
> determine what type
> > > of databa se dictionary to use.  To prevent this connection in the
> > > future, set your openjp a.jdbc.DBDictionary configuration 
> property to
> > > the appropriate value for your dat abase (see the 
> documentation for
> > > available values).
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > openjpa.jdbc.JDBC -
> > > Usin
> > > g dictionary class
> > > "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c
> > > ommunity-nt ,MySQL-AB JDBC Driver 
> mysql-connector-java-5.0.4 ( $Date:
> > > 2006-10-19
> > >  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > > openjpa.MetaData -
> > > Found
> > >  1 classes with metadata in 0 milliseconds.
> > >
> > >
> > > It seems that OpenJPA is now bootstrapping everytime I 
> access it. I am
> > > binding the EMF somewhen at bootstrapping time with
> > >
> > > final EntityManagerFactory emFactory = Persistence
> > > 				.createEntityManagerFactory("lbsims");
> > >
> > > Context ictx = new InitialContext();
> > > ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> > >
> > > The lookup uses the same constants, so the EMF in JNDI should be
> > > found?
> > >
> > > EntityManagerFactory emf = OpenJPAPersistence
> > >
> > > .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> > >
> > > Any Idea what could be wrong here?
> > >
> > > regards,
> > > HANS
> > >
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > Gesendet: Freitag, 23. Februar 2007 18:46
> > > > An: open-jpa-dev@incubator.apache.org
> > > > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 
> session beans?
> > > > [architecture]
> > > >
> > > > Typo indeed. It should be
> > > OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > > > about that.
> > > >
> > > > -Patrick
> > > >
> > > > --
> > > > Patrick Linskey
> > > > BEA Systems, Inc.
> > > >
> > > >
> > > ______________________________________________________________
> > > _________
> > > > Notice:  This email message, together with any attachments,
> > > may contain
> > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > >  affiliated
> > > > entities,  that may be confidential,  proprietary,
> > > copyrighted  and/or
> > > > legally privileged, and is intended solely for the use of
> > > the individual
> > > > or entity named in this message. If you are not the
> > > intended recipient,
> > > > and have received this message in error, please immediately
> > > return this
> > > > by email and then delete it.
> > > >
> > > > > -----Original Message-----
> > > > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > > > Sent: Friday, February 23, 2007 9:43 AM
> > > > > To: open-jpa-dev@incubator.apache.org
> > > > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > > > > beans? [architecture]
> > > > >
> > > > > Patrick,
> > > > >
> > > > > I'm currently trying your tip with a 
> PersistenceService util class
> > > > > doing the lookup of a synchronized entity manager. 
> The problem is
> > > > > that your sample code does not work!
> > > > >
> > > > > in fact the statement
> > > > >
> > > > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > >
> > > > > is the problem. the above "cast" does not return a 
> BrokerFactory
> > > > > instance!
> > > > >
> > > > > I am using a 2 days old nightly snapshot 0.9.7 build
> > > > >
> > > > > Where is the problem?
> > > > >
> > > > > Hans
> > > > >
> > > > > > -----Ursprüngliche Nachricht-----
> > > > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1
> > > session beans?
> > > > > > [architecture]
> > > > > >
> > > > > > > Unfortunately, that means that we're using a synchronized
> > > > > > > block during the lookup. If it looks like EM lookup is a
> > > > > > > scalability issue for your app, do let us know -- 
> it would be
> > > > > > > pretty straightforward to replace the 
> synchronized block with
> > > > > > > a concurrent map.
> > > > > >
> > > > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > > > tracks the
> > > > > > issue; I've got a patch that I'll submit once some more
> > > > > eyes look at it.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > BEA Systems, Inc.
> > > > > >
> > > > > >
> > > > > ______________________________________________________________
> > > > > _________
> > > > > > Notice:  This email message, together with any attachments,
> > > > > may contain
> > > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > >  affiliated
> > > > > > entities,  that may be confidential,  proprietary,
> > > > > copyrighted  and/or
> > > > > > legally privileged, and is intended solely for the use of
> > > > > the individual
> > > > > > or entity named in this message. If you are not the
> > > > > intended recipient,
> > > > > > and have received this message in error, please immediately
> > > > > return this
> > > > > > by email and then delete it.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > > > > beans? [architecture]
> > > > > > >
> > > > > > > > If I understand it correct, I "just" have to 
> bind the EMF
> > > > > > > > onserver startup like.
> > > > > > > >
> > > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > >
> > > > > > > Yep.
> > > > > > >
> > > > > > > >         //does the statement below again create 
> a NEW EMF
> > > > > > > or ist this
> > > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > > called "Create"
> > > > > > > >         //and not get?
> > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > >             .createEntityManagerFactory(
> > > > > > > >                 "your/EMF/JNDI/location", 
> (Context) null);
> > > > > > >
> > > > > > > It's just a lookup. I'm not sure why it's called
> > > 'create'. Anyone?
> > > > > > >
> > > > > > > >         //why do I have to create a new
> > > > > > > broker/entitymanager this way?
> > > > > > > >         //is this because I have to 
> "synchronize" the SLSBs
> > > > > > > > transaction
> > > > > > > >         //context with the newly created entitymanager?
> > > > > > >
> > > > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > > > all create new
> > > > > > > EMs. The broker code will look up one associated with
> > > the current
> > > > > > > transaction, which is what you're looking for.
> > > > > > >
> > > > > > > Unfortunately, that means that we're using a synchronized
> > > > > block during
> > > > > > > the lookup. If it looks like EM lookup is a scalability
> > > > > issue for your
> > > > > > > app, do let us know -- it would be pretty 
> straightforward to
> > > > > > > replace the synchronized block with a concurrent map.
> > > > > > >
> > > > > > > > So if understand that right I just would have to call
> > > > > > > >
> > > > > > > > PersistenceService.getEntitymanager();
> > > > > > > >
> > > > > > > > in every SLSB method (NOT in ejbCreate) when 
> needed? fine.
> > > > > > >
> > > > > > > Yep.
> > > > > > >
> > > > > > > > I really appreciate your help - it's quite complex
> > > to integrate
> > > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > > environment.. *puh*
> > > > > > >
> > > > > > > Yes -- sorry about that. We should at least be creating
> > > > > > > better-designed helper methods in OpenJPA to help out with
> > > > > > > this.
> > > > > > >
> > > > > > > One alternative, of course, is to use Spring 2, 
> which does a
> > > > > > > pretty good job of JPA bootstrapping.
> > > > > > >
> > > > > > > -Patrick
> > > > > > >
> > > > > > > --
> > > > > > > Patrick Linskey
> > > > > > > BEA Systems, Inc.
> > > > > > >
> > > > > > > 
> ______________________________________________________________
> > > > > > > _________
> > > > > > > Notice:  This email message, together with any 
> attachments,
> > > > > > > may contain information  of  BEA Systems,  Inc.,  its
> > > > > > > subsidiaries  and affiliated entities,  that may be
> > > > > > > confidential,  proprietary, copyrighted  and/or legally
> > > > > > > privileged, and is intended solely for the use of the
> > > > > > > individual or entity named in this message. If 
> you are not the
> > > > > > > intended recipient, and have received this 
> message in error,
> > > > > > > please immediately return this by email and then 
> delete it.
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > > > open-jpa-dev@incubator.apache.org
> > > > > > > > Subject: Re: RE: Howto integrate JPA within 
> EJB2.1 session
> > > > > > > > beans? [architecture]
> > > > > > > >
> > > > > > > > Patrick,
> > > > > > > >
> > > > > > > > thank you for that tip. To be true, I was not aware of
> > > > > > > > lifecycle related problems between my SLSBs and 
> JPA - thank
> > > > > > > > you for that hint. As I want to avoid working with
> > > > > > > > ThreadLocal (simply because I didn't work with 
> ThreadLocals
> > > > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > > > >
> > > > > > > > If I understand it correct, I "just" have to 
> bind the EMF
> > > > > > > > onserver startup like.
> > > > > > > >
> > > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > > >
> > > > > > > > I would be interested what the code for the
> > > > > > > > PersistenceService class does:
> > > > > > > >
> > > > > > > >
> > > > > > > >         //does the statement below again create 
> a NEW EMF
> > > > > > > or ist this
> > > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > > called "Create"
> > > > > > > >         //and not get?
> > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > >             .createEntityManagerFactory(
> > > > > > > >                 "your/EMF/JNDI/location", 
> (Context) null);
> > > > > > > >
> > > > > > > >         //why do i have to cast the EMF to a
> > > > > brokerfactory now? I
> > > > > > > >         //would guess the "broker" is something like a
> > > > > more abstract
> > > > > > > >         //concept of entitymanager(factory)?
> > > > > > > >
> > > > > > > >         //why do I have to create a new
> > > > > > > broker/entitymanager this way?
> > > > > > > >         //is this because I have to 
> "synchronize" the SLSBs
> > > > > > > > transaction
> > > > > > > >         //context with the newly created entitymanager?
> > > > > > > >
> > > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > > >         Broker b = bf.newBroker(
> > > > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > > > >           true, // the broker is part of a JTA 
> managed tx
> > > > > > > >
> > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > >           true); // look for an existing Broker 
> on the tx
> > > > > > > >
> > > > > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > >
> > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > >         broker.setDetachedNew(false);
> > > > > > > >
> > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > >     }
> > > > > > > >
> > > > > > > > So if understand that right I just would have to call
> > > > > > > >
> > > > > > > > PersistenceService.getEntitymanager();
> > > > > > > >
> > > > > > > > in every SLSB method (NOT in ejbCreate) when 
> needed? fine. I
> > > > > > > > really appreciate your help - it's quite complex to
> > > integrate
> > > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > > environment.. *puh*
> > > > > > > >
> > > > > > > > regards
> > > > > > > > Hans
> > > > > > > >
> > > > > > > > -------- Original-Nachricht --------
> > > > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > > > CC:
> > > > > > > > Betreff: RE: Howto integrate JPA within EJB2.1
> > > session beans?
> > > > > > > > [architecture]
> > > > > > > >
> > > > > > > > > Another common technique is to get an EMF into
> > > JNDI, either
> > > > > > > > by using a
> > > > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > > > >
> > > > > > > > > Are you looking to integrate OpenJPA with your
> > > current managed
> > > > > > > > > transaction? If so, I'd be careful about 
> creating an EM in
> > > > > > > > ejbCreate(),
> > > > > > > > > as its lifecycle is related to the life of the SLSB,
> > > > > not to the
> > > > > > > > > transactional context (the SLSB might be 
> pooled). So, I'd
> > > > > > > > just try to
> > > > > > > > > get the EMF into JNDI when the server starts
> > > (creating EMFs
> > > > > > > > is slow).
> > > > > > > > > Then, you could avoid having to use your own 
> ThreadLocal
> > > > > > > > work by using
> > > > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > > > >
> > > > > > > > > public class PersistenceService {
> > > > > > > > >     public static EntityManager getEntityManager() {
> > > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > > >             .createEntityManagerFactory(
> > > > > > > > >                 "your/EMF/JNDI/location", 
> (Context) null);
> > > > > > > > >         BrokerFactory bf = 
> OpenJPAPersistence.cast(emf);
> > > > > > > > >         Broker b = bf.newBroker(
> > > > > > > > >             
> bf.getConfiguration().getConnectionUserName(),
> > > > > > > > >             
> bf.getConfiguration().getConnectionPassword(),
> > > > > > > > >             true, // the broker is part of a JTA
> > > managed tx
> > > > > > > > >
> > > > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > > >             true); // look for an existing Broker
> > > on the tx
> > > > > > > > >
> > > > > > > > >         // do some JPA configuration setup. Logic
> > > stolen from
> > > > > > > > >         // EntityManagerFactoryImpl.
> > > > > > > > >
> > > broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > > >
> > > > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > > >         broker.setDetachedNew(false);
> > > > > > > > >
> > > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > > >     }
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > Meanwhile, we really should add a couple new
> > > > > OpenJPAPersistence /
> > > > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > > > this type of
> > > > > > > > > bootstrapping.
> > > > > > > > >
> > > > > > > > > -Patrick
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Patrick Linskey
> > > > > > > > > BEA Systems, Inc.
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > ______________________________________________________________
> > > > > > > > _________
> > > > > > > > > Notice:  This email message, together with any
> > > attachments,
> > > > > > > > may contain
> > > > > > > > > information  of  BEA Systems,  Inc.,  its
> > > subsidiaries  and
> > > > > > > >  affiliated
> > > > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > > > copyrighted  and/or
> > > > > > > > > legally privileged, and is intended solely 
> for the use of
> > > > > > > > the individual
> > > > > > > > > or entity named in this message. If you are not the
> > > > > > > > intended recipient,
> > > > > > > > > and have received this message in error, please
> > > immediately
> > > > > > > > return this
> > > > > > > > > by email and then delete it.
> > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > > > Subject: Howto integrate JPA within EJB2.1
> > > session beans?
> > > > > > > > > > [architecture]
> > > > > > > > > >
> > > > > > > > > > Hi together,
> > > > > > > > > >
> > > > > > > > > > I'm sorry for bothering you with numerous basic
> > > questions
> > > > > > > > > > regarding OpenJPA and its usage but I have 
> to migrate
> > > > > > > > > > existing CMP EJBs to migrate within short time
> > > to OpenJPA as
> > > > > > > > > > we're having stability issues with the current
> > > CMP engine.
> > > > > > > > > >
> > > > > > > > > > One last question I'd like to ask is regarding the
> > > > > > > > > > recommended architecture of using OpenJPA 
> within EJB2.1
> > > > > > > > > > Stateless sessino beans:
> > > > > > > > > >
> > > > > > > > > > I need to work with persistence i.e. the 
> EntityManager
> > > > > > > > > > throughout all the session beans methods so my
> > > idea is to:
> > > > > > > > > >
> > > > > > > > > > - create a EntityManagerFactory in the
> > > ejbCreate() method
> > > > > > > > of the SLSB
> > > > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > > > ejbCreeate() method and store it as a 
> member variable
> > > > > > > of the SLSB
> > > > > > > > > > - this would allow easy access within the SB's
> > > methods by
> > > > > > > > > > just using the already initialized entity
> > > manager varialbe
> > > > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > > > - clean up should be performed in the 
> ejbRemove() method
> > > > > > > > of the SLSB
> > > > > > > > > >
> > > > > > > > > > I think doing so will allow migratino to
> > > openJPA with less
> > > > > > > > > > work than doing the whole lookup procedure in
> > > every method
> > > > > > > > > > separately.
> > > > > > > > > >
> > > > > > > > > > what do you think? are there any pitfalls i've
> > > overlooked?
> > > > > > > > > >
> > > > > > > > > > thank you for your ideas!
> > > > > > > > > >
> > > > > > > > > > regards
> > > > > > > > > > Hans
> > > > > > > > > > --
> > > > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > > > Jetzt GMX ProMail testen:
> > > > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > Jetzt GMX ProMail testen:
> > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > >
> > > > > > >
> > > > >
> > > > >
> > >
> > >
> 
> 

RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Patrick Linskey <pl...@bea.com>.
Yes, this is a possibility. However, currently, the logging makes it look like the PersistenceService class is running through logic that identifies that it needs to create a new instance.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Pinaki Poddar 
> Sent: Tuesday, February 27, 2007 9:48 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: EMF JNDI lookup is starting openJPA every time - 
> was: Howto integrate JPA within EJB2.1 session beans? 
> 
>  > But maybe something funky is happening with JNDI 
> serializing the factory and then deserializing it or something.
> 
> From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and 
> Directory Interface:
> 
> In general, lookups of objects in the JNDI java: namespace 
> are required to return a new instance of the requested object 
> every time. Exceptions are 
> allowed for the following:
> - The container knows the object is immutable (for example, 
> objects of type java.lang.String), or knows that the 
> application can't change the state of 
> the object.
> -The object is defined to be a singleton, such that only one 
> instance of the object may exist in the JVM.
> -The name used for the lookup is defined to return an 
> instance of the object that might be shared. The name 
> java:comp/ORB is such a name.
> 
> In these cases, a shared instance of the object may be 
> returned. In all other cases, a new instance of the requested 
> object must be returned on each 
> lookup.
> 
> 
> Pinaki Poddar
> BEA Systems
> 415.402.7317  
> 
> 
> -----Original Message-----
> From: Patrick Linskey [mailto:plinskey@bea.com] 
> Sent: Monday, February 26, 2007 11:11 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: EMF JNDI lookup is starting openJPA every time - 
> was: Howto integrate JPA within EJB2.1 session beans? 
> 
> It should be going through the following code:
> 
>     public static OpenJPAEntityManagerFactory 
> createEntityManagerFactory
>         (String jndiLocation, Context context) {
>         if (jndiLocation == null)
>             throw new NullPointerException("jndiLocation == null");
> 
>         try {
>             if (context == null)
>                 context = new InitialContext();
> 
>             Object o = context.lookup(jndiLocation);
>             return (OpenJPAEntityManagerFactory) 
> PortableRemoteObject.narrow(o,
>                 OpenJPAEntityManagerFactory.class);
>         } catch (NamingException ne) {
>             throw new ArgumentException(_loc.get("naming-exception",
>                 jndiLocation), new Throwable[]{ ne }, null, true);
>         }
>     }
> 
> I don't see anything in there that would be causing a 
> creation to happen. But maybe something funky is happening 
> with JNDI serializing the factory and then deserializing it 
> or something.
> 
> Do you have any means of getting a stack from where the 
> creation is happening? It'd be great to get a bit more 
> context about what's going on.
> 
> -Patrick
> 
> --
> Patrick Linskey
> BEA Systems, Inc. 
> 
> ______________________________________________________________
> _________
> Notice:  This email message, together with any attachments, 
> may contain information  of  BEA Systems,  Inc.,  its 
> subsidiaries  and  affiliated entities,  that may be 
> confidential,  proprietary,  copyrighted  and/or legally 
> privileged, and is intended solely for the use of the 
> individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in 
> error, please immediately return this by email and then delete it. 
> 
> > -----Original Message-----
> > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > Sent: Saturday, February 24, 2007 10:36 PM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: EMF JNDI lookup is starting openJPA every time -
> > was: Howto integrate JPA within EJB2.1 session beans? 
> > 
> > Hi together, Patrick,
> > 
> > the code you suggested for doing a helper method that deals 
> with the 
> > EMF JNDI lookup and the EM creating within our J2EE1.4 app 
> basically 
> > works fine, but as you perhaps may remember I asked why the 
> method is 
> > called "create":
> > 
> > EntityManagerFactory myemf =
> > OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> > (Context)null);
> > 
> > It seems that the method above really creates a NEW EMF on every 
> > invocation!
> > I checked the logs of my application and I see the 
> following messages 
> > on every invocation of my PersistenceService.getEntityManger()
> > method (which
> > does the above lookup and some more ..)
> > 
> > 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
> > : creating a
> > fresh
> > , clean EntityManager from JNDI EMF.
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.Runtime -
> > Starti
> > ng OpenJPA 0.9.7-incubating-SNAPSHOT
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.jdbc.JDBC -
> > Open
> > JPA will now connect to the database to attempt to 
> determine what type 
> > of databa se dictionary to use.  To prevent this connection in the 
> > future, set your openjp a.jdbc.DBDictionary configuration 
> property to 
> > the appropriate value for your dat abase (see the documentation for 
> > available values).
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.jdbc.JDBC -
> > Usin
> > g dictionary class
> > "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c 
> > ommunity-nt ,MySQL-AB JDBC Driver 
> mysql-connector-java-5.0.4 ( $Date:
> > 2006-10-19
> >  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.MetaData -
> > Found
> >  1 classes with metadata in 0 milliseconds.
> > 
> > 
> > It seems that OpenJPA is now bootstrapping everytime I 
> access it. I am 
> > binding the EMF somewhen at bootstrapping time with
> > 
> > final EntityManagerFactory emFactory = Persistence
> > 				.createEntityManagerFactory("lbsims");
> > 
> > Context ictx = new InitialContext();
> > ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> > 
> > The lookup uses the same constants, so the EMF in JNDI should be 
> > found?
> > 
> > EntityManagerFactory emf = OpenJPAPersistence
> > 	
> > .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> > 
> > Any Idea what could be wrong here?
> > 
> > regards,
> > HANS
> > 
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > Gesendet: Freitag, 23. Februar 2007 18:46
> > > An: open-jpa-dev@incubator.apache.org
> > > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 
> session beans?
> > > [architecture]
> > > 
> > > Typo indeed. It should be
> > OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > > about that.
> > > 
> > > -Patrick
> > > 
> > > --
> > > Patrick Linskey
> > > BEA Systems, Inc.
> > > 
> > > 
> > ______________________________________________________________
> > _________
> > > Notice:  This email message, together with any attachments,
> > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >  affiliated
> > > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of
> > the individual
> > > or entity named in this message. If you are not the
> > intended recipient,
> > > and have received this message in error, please immediately
> > return this
> > > by email and then delete it.
> > > 
> > > > -----Original Message-----
> > > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > > Sent: Friday, February 23, 2007 9:43 AM
> > > > To: open-jpa-dev@incubator.apache.org
> > > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session 
> > > > beans? [architecture]
> > > >
> > > > Patrick,
> > > >
> > > > I'm currently trying your tip with a PersistenceService 
> util class 
> > > > doing the lookup of a synchronized entity manager. The 
> problem is 
> > > > that your sample code does not work!
> > > >
> > > > in fact the statement
> > > >
> > > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > >
> > > > is the problem. the above "cast" does not return a 
> BrokerFactory 
> > > > instance!
> > > >
> > > > I am using a 2 days old nightly snapshot 0.9.7 build
> > > >
> > > > Where is the problem?
> > > >
> > > > Hans
> > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > > An: open-jpa-dev@incubator.apache.org
> > > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1
> > session beans?
> > > > > [architecture]
> > > > >
> > > > > > Unfortunately, that means that we're using a synchronized 
> > > > > > block during the lookup. If it looks like EM lookup is a 
> > > > > > scalability issue for your app, do let us know -- 
> it would be 
> > > > > > pretty straightforward to replace the synchronized 
> block with 
> > > > > > a concurrent map.
> > > > >
> > > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > > tracks the
> > > > > issue; I've got a patch that I'll submit once some more
> > > > eyes look at it.
> > > > >
> > > > > -Patrick
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > BEA Systems, Inc.
> > > > >
> > > > >
> > > > ______________________________________________________________
> > > > _________
> > > > > Notice:  This email message, together with any attachments,
> > > > may contain
> > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > >  affiliated
> > > > > entities,  that may be confidential,  proprietary,
> > > > copyrighted  and/or
> > > > > legally privileged, and is intended solely for the use of
> > > > the individual
> > > > > or entity named in this message. If you are not the
> > > > intended recipient,
> > > > > and have received this message in error, please immediately
> > > > return this
> > > > > by email and then delete it.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session 
> > > > > > beans? [architecture]
> > > > > >
> > > > > > > If I understand it correct, I "just" have to bind the EMF 
> > > > > > > onserver startup like.
> > > > > > >
> > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > >
> > > > > > Yep.
> > > > > >
> > > > > > >         //does the statement below again create a NEW EMF
> > > > > > or ist this
> > > > > > >         //just a lookup in the jndi-tree? but why is it 
> > > > > > > called "Create"
> > > > > > >         //and not get?
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > >
> > > > > > It's just a lookup. I'm not sure why it's called
> > 'create'. Anyone?
> > > > > >
> > > > > > >         //why do I have to create a new
> > > > > > broker/entitymanager this way?
> > > > > > >         //is this because I have to "synchronize" 
> the SLSBs 
> > > > > > > transaction
> > > > > > >         //context with the newly created entitymanager?
> > > > > >
> > > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > > all create new
> > > > > > EMs. The broker code will look up one associated with
> > the current
> > > > > > transaction, which is what you're looking for.
> > > > > >
> > > > > > Unfortunately, that means that we're using a synchronized
> > > > block during
> > > > > > the lookup. If it looks like EM lookup is a scalability
> > > > issue for your
> > > > > > app, do let us know -- it would be pretty 
> straightforward to 
> > > > > > replace the synchronized block with a concurrent map.
> > > > > >
> > > > > > > So if understand that right I just would have to call
> > > > > > >
> > > > > > > PersistenceService.getEntitymanager();
> > > > > > >
> > > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > > > > >
> > > > > > Yep.
> > > > > >
> > > > > > > I really appreciate your help - it's quite complex
> > to integrate
> > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > environment.. *puh*
> > > > > >
> > > > > > Yes -- sorry about that. We should at least be creating 
> > > > > > better-designed helper methods in OpenJPA to help out with 
> > > > > > this.
> > > > > >
> > > > > > One alternative, of course, is to use Spring 2, 
> which does a 
> > > > > > pretty good job of JPA bootstrapping.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > BEA Systems, Inc.
> > > > > >
> > > > > > 
> ______________________________________________________________
> > > > > > _________
> > > > > > Notice:  This email message, together with any attachments, 
> > > > > > may contain information  of  BEA Systems,  Inc.,  its 
> > > > > > subsidiaries  and affiliated entities,  that may be 
> > > > > > confidential,  proprietary, copyrighted  and/or legally 
> > > > > > privileged, and is intended solely for the use of the 
> > > > > > individual or entity named in this message. If you 
> are not the 
> > > > > > intended recipient, and have received this message 
> in error, 
> > > > > > please immediately return this by email and then delete it.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > > open-jpa-dev@incubator.apache.org
> > > > > > > Subject: Re: RE: Howto integrate JPA within 
> EJB2.1 session 
> > > > > > > beans? [architecture]
> > > > > > >
> > > > > > > Patrick,
> > > > > > >
> > > > > > > thank you for that tip. To be true, I was not aware of 
> > > > > > > lifecycle related problems between my SLSBs and 
> JPA - thank 
> > > > > > > you for that hint. As I want to avoid working with 
> > > > > > > ThreadLocal (simply because I didn't work with 
> ThreadLocals
> > > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > > >
> > > > > > > If I understand it correct, I "just" have to bind the EMF 
> > > > > > > onserver startup like.
> > > > > > >
> > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > >
> > > > > > > I would be interested what the code for the 
> > > > > > > PersistenceService class does:
> > > > > > >
> > > > > > >
> > > > > > >         //does the statement below again create a NEW EMF
> > > > > > or ist this
> > > > > > >         //just a lookup in the jndi-tree? but why is it 
> > > > > > > called "Create"
> > > > > > >         //and not get?
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > > >
> > > > > > >         //why do i have to cast the EMF to a
> > > > brokerfactory now? I
> > > > > > >         //would guess the "broker" is something like a
> > > > more abstract
> > > > > > >         //concept of entitymanager(factory)?
> > > > > > >
> > > > > > >         //why do I have to create a new
> > > > > > broker/entitymanager this way?
> > > > > > >         //is this because I have to "synchronize" 
> the SLSBs 
> > > > > > > transaction
> > > > > > >         //context with the newly created entitymanager?
> > > > > > >
> > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > >         Broker b = bf.newBroker(
> > > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > > >           true, // the broker is part of a JTA managed tx
> > > > > > >
> > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > >           true); // look for an existing Broker on the tx
> > > > > > >
> > > > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > >         
> > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > >         broker.setDetachedNew(false);
> > > > > > >
> > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > >     }
> > > > > > >
> > > > > > > So if understand that right I just would have to call
> > > > > > >
> > > > > > > PersistenceService.getEntitymanager();
> > > > > > >
> > > > > > > in every SLSB method (NOT in ejbCreate) when 
> needed? fine. I 
> > > > > > > really appreciate your help - it's quite complex to
> > integrate
> > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > environment.. *puh*
> > > > > > >
> > > > > > > regards
> > > > > > > Hans
> > > > > > >
> > > > > > > -------- Original-Nachricht --------
> > > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > > CC:
> > > > > > > Betreff: RE: Howto integrate JPA within EJB2.1
> > session beans?
> > > > > > > [architecture]
> > > > > > >
> > > > > > > > Another common technique is to get an EMF into
> > JNDI, either
> > > > > > > by using a
> > > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > > >
> > > > > > > > Are you looking to integrate OpenJPA with your
> > current managed
> > > > > > > > transaction? If so, I'd be careful about 
> creating an EM in
> > > > > > > ejbCreate(),
> > > > > > > > as its lifecycle is related to the life of the SLSB,
> > > > not to the
> > > > > > > > transactional context (the SLSB might be 
> pooled). So, I'd
> > > > > > > just try to
> > > > > > > > get the EMF into JNDI when the server starts
> > (creating EMFs
> > > > > > > is slow).
> > > > > > > > Then, you could avoid having to use your own ThreadLocal
> > > > > > > work by using
> > > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > > >
> > > > > > > > public class PersistenceService {
> > > > > > > >     public static EntityManager getEntityManager() {
> > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > >             .createEntityManagerFactory(
> > > > > > > >                 "your/EMF/JNDI/location", 
> (Context) null);
> > > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > > >         Broker b = bf.newBroker(
> > > > > > > >             
> bf.getConfiguration().getConnectionUserName(),
> > > > > > > >             
> bf.getConfiguration().getConnectionPassword(),
> > > > > > > >             true, // the broker is part of a JTA
> > managed tx
> > > > > > > >
> > > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > >             true); // look for an existing Broker
> > on the tx
> > > > > > > >
> > > > > > > >         // do some JPA configuration setup. Logic
> > stolen from
> > > > > > > >         // EntityManagerFactoryImpl.
> > > > > > > >         
> > broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > >
> > > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > >         broker.setDetachedNew(false);
> > > > > > > >
> > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > >     }
> > > > > > > > }
> > > > > > > >
> > > > > > > > Meanwhile, we really should add a couple new
> > > > OpenJPAPersistence /
> > > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > > this type of
> > > > > > > > bootstrapping.
> > > > > > > >
> > > > > > > > -Patrick
> > > > > > > >
> > > > > > > > --
> > > > > > > > Patrick Linskey
> > > > > > > > BEA Systems, Inc.
> > > > > > > >
> > > > > > > >
> > > > > > > 
> > ______________________________________________________________
> > > > > > > _________
> > > > > > > > Notice:  This email message, together with any
> > attachments,
> > > > > > > may contain
> > > > > > > > information  of  BEA Systems,  Inc.,  its
> > subsidiaries  and
> > > > > > >  affiliated
> > > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > > copyrighted  and/or
> > > > > > > > legally privileged, and is intended solely for 
> the use of
> > > > > > > the individual
> > > > > > > > or entity named in this message. If you are not the
> > > > > > > intended recipient,
> > > > > > > > and have received this message in error, please
> > immediately
> > > > > > > return this
> > > > > > > > by email and then delete it.
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > > Subject: Howto integrate JPA within EJB2.1
> > session beans?
> > > > > > > > > [architecture]
> > > > > > > > >
> > > > > > > > > Hi together,
> > > > > > > > >
> > > > > > > > > I'm sorry for bothering you with numerous basic
> > questions
> > > > > > > > > regarding OpenJPA and its usage but I have to migrate 
> > > > > > > > > existing CMP EJBs to migrate within short time
> > to OpenJPA as
> > > > > > > > > we're having stability issues with the current
> > CMP engine.
> > > > > > > > >
> > > > > > > > > One last question I'd like to ask is regarding the 
> > > > > > > > > recommended architecture of using OpenJPA 
> within EJB2.1 
> > > > > > > > > Stateless sessino beans:
> > > > > > > > >
> > > > > > > > > I need to work with persistence i.e. the 
> EntityManager 
> > > > > > > > > throughout all the session beans methods so my
> > idea is to:
> > > > > > > > >
> > > > > > > > > - create a EntityManagerFactory in the
> > ejbCreate() method
> > > > > > > of the SLSB
> > > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > > ejbCreeate() method and store it as a member variable
> > > > > > of the SLSB
> > > > > > > > > - this would allow easy access within the SB's
> > methods by
> > > > > > > > > just using the already initialized entity
> > manager varialbe
> > > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > > - clean up should be performed in the 
> ejbRemove() method
> > > > > > > of the SLSB
> > > > > > > > >
> > > > > > > > > I think doing so will allow migratino to
> > openJPA with less
> > > > > > > > > work than doing the whole lookup procedure in
> > every method
> > > > > > > > > separately.
> > > > > > > > >
> > > > > > > > > what do you think? are there any pitfalls i've
> > overlooked?
> > > > > > > > >
> > > > > > > > > thank you for your ideas!
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > > Hans
> > > > > > > > > --
> > > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > > Jetzt GMX ProMail testen:
> > > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > Jetzt GMX ProMail testen:
> > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > >
> > > > > >
> > > >
> > > >
> > 
> > 
> 

Re: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Pinaki,


On Feb 27, 2007, at 5:06 PM, Pinaki Poddar wrote:

> The JNDI spec says:  "the container knows that the application  
> can't change the state of the object."
> How does one tell the container that the JNDI-bound instance is one  
> such 'application immutable' object?
>
>> What we ended up with was implementing the naming.Referenceable  
>> interface
> Did the JDO solution defined its own javax.naming.spi.ObjectFactory  
> to take control of how JNDI-bound instances are created on lookup?

Exactly. See http://svn.apache.org/repos/asf/db/jdo/trunk/fostore20/ 
src/java/org/apache/jdo/impl/fostore/FOStorePMFFactory.java

This is the code that implements ObjectFactory.

And see
http://svn.apache.org/repos/asf/db/jdo/trunk/fostore20/src/java/org/ 
apache/jdo/impl/fostore/FOStorePMF.java

There is code to find an identically-configured PMF in the method  
getPersistenceManagerFactory(Properties).

The final step of connecting the getObjectInstance to the  
getPersistenceManagerFactory(Properties) wasn't done but this is the  
obvious way to do it. In other words, in getObjectInstance, convert  
the StringRefAddrs into Properties and then find the matching  
PersistenceManagerFactory in the map.

Craig


>
>
>
> Pinaki Poddar
> BEA Systems
> 415.402.7317
>
>
> -----Original Message-----
> From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM]
> Sent: Tuesday, February 27, 2007 3:32 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: EMF JNDI lookup is starting openJPA every time - was:  
> Howto integrate JPA within EJB2.1 session beans?
>
> We had a similar issue with the JDO Reference Implementation. What  
> we ended up with was implementing the naming.Referenceable  
> interface and writing our own externalization protocols that  
> basically allowed the container to create new instances of our  
> Factory that were actually trivial wrappers that delegated to the  
> real Factory.
>
> So yes, I believe that unless a container "knows" that a bound  
> value is actually sharable (see below), it will generally serialize  
> the instance and then deserialize it for each caller. The way to  
> make this operation perform well (short of telling the container to  
> share
> it) is to implement the Referenceable contracts.
>
> I can drag out more details if there is interest. Or you can look  
> at the implementation of FOStorePMF in the Apache JDO project.
>
> Craig
>
> On Feb 27, 2007, at 9:47 AM, Pinaki Poddar wrote:
>
>>> But maybe something funky is happening with JNDI serializing the
>>> factory and then deserializing it or something.
>>
>> From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and Directory
>> Interface:
>>
>> In general, lookups of objects in the JNDI java: namespace are
>> required to return a new instance of the requested object every time.
>> Exceptions are allowed for the following:
>> - The container knows the object is immutable (for example,  
>> objects of
>> type java.lang.String), or knows that the application can't change  
>> the
>> state of the object.
>> -The object is defined to be a singleton, such that only one instance
>> of the object may exist in the JVM.
>> -The name used for the lookup is defined to return an instance of the
>> object that might be shared. The name java:comp/ORB is such a name.
>>
>> In these cases, a shared instance of the object may be returned. In
>> all other cases, a new instance of the requested object must be
>> returned on each lookup.
>>
>>
>> Pinaki Poddar
>> BEA Systems
>> 415.402.7317
>>
>>
>> -----Original Message-----
>> From: Patrick Linskey [mailto:plinskey@bea.com]
>> Sent: Monday, February 26, 2007 11:11 PM
>> To: open-jpa-dev@incubator.apache.org
>> Subject: RE: EMF JNDI lookup is starting openJPA every time - was:
>> Howto integrate JPA within EJB2.1 session beans?
>>
>> It should be going through the following code:
>>
>>     public static OpenJPAEntityManagerFactory
>> createEntityManagerFactory
>>         (String jndiLocation, Context context) {
>>         if (jndiLocation == null)
>>             throw new NullPointerException("jndiLocation == null");
>>
>>         try {
>>             if (context == null)
>>                 context = new InitialContext();
>>
>>             Object o = context.lookup(jndiLocation);
>>             return (OpenJPAEntityManagerFactory)
>> PortableRemoteObject.narrow(o,
>>                 OpenJPAEntityManagerFactory.class);
>>         } catch (NamingException ne) {
>>             throw new ArgumentException(_loc.get("naming-exception",
>>                 jndiLocation), new Throwable[]{ ne }, null, true);
>>         }
>>     }
>>
>> I don't see anything in there that would be causing a creation to
>> happen. But maybe something funky is happening with JNDI serializing
>> the factory and then deserializing it or something.
>>
>> Do you have any means of getting a stack from where the creation is
>> happening? It'd be great to get a bit more context about what's going
>> on.
>>
>> -Patrick
>>
>> --
>> Patrick Linskey
>> BEA Systems, Inc.
>>
>> _____________________________________________________________________ 
>> _
>> _
>> Notice:  This email message, together with any attachments, may
>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
>> and  affiliated entities,  that may be confidential,  proprietary,
>> copyrighted  and/or legally privileged, and is intended solely for  
>> the
>> use of the individual or entity named in this message. If you are not
>> the intended recipient, and have received this message in error,
>> please immediately return this by email and then delete it.
>>
>>> -----Original Message-----
>>> From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
>>> Sent: Saturday, February 24, 2007 10:36 PM
>>> To: open-jpa-dev@incubator.apache.org
>>> Subject: EMF JNDI lookup is starting openJPA every time -
>>> was: Howto integrate JPA within EJB2.1 session beans?
>>>
>>> Hi together, Patrick,
>>>
>>> the code you suggested for doing a helper method that deals with the
>>> EMF JNDI lookup and the EM creating within our J2EE1.4 app basically
>>> works fine, but as you perhaps may remember I asked why the  
>>> method is
>>> called "create":
>>>
>>> EntityManagerFactory myemf =
>>> OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
>>> (Context)null);
>>>
>>> It seems that the method above really creates a NEW EMF on every
>>> invocation!
>>> I checked the logs of my application and I see the following  
>>> messages
>>> on every invocation of my PersistenceService.getEntityManger()
>>> method (which
>>> does the above lookup and some more ..)
>>>
>>> 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
>>> : creating a
>>> fresh
>>> , clean EntityManager from JNDI EMF.
>>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>>> openjpa.Runtime -
>>> Starti
>>> ng OpenJPA 0.9.7-incubating-SNAPSHOT
>>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>>> openjpa.jdbc.JDBC -
>>> Open
>>> JPA will now connect to the database to attempt to determine what
>>> type of databa se dictionary to use.  To prevent this connection in
>>> the future, set your openjp a.jdbc.DBDictionary configuration
>>> property to the appropriate value for your dat abase (see the
>>> documentation for available values).
>>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>>> openjpa.jdbc.JDBC -
>>> Usin
>>> g dictionary class
>>> "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c
>>> ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4  
>>> ( $Date:
>>> 2006-10-19
>>>  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
>>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>>> openjpa.MetaData -
>>> Found
>>>  1 classes with metadata in 0 milliseconds.
>>>
>>>
>>> It seems that OpenJPA is now bootstrapping everytime I access it.
>>> I am
>>> binding the EMF somewhen at bootstrapping time with
>>>
>>> final EntityManagerFactory emFactory = Persistence
>>> 				.createEntityManagerFactory("lbsims");
>>>
>>> Context ictx = new InitialContext();
>>> ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
>>>
>>> The lookup uses the same constants, so the EMF in JNDI should be
>>> found?
>>>
>>> EntityManagerFactory emf = OpenJPAPersistence
>>> 	
>>> .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
>>>
>>> Any Idea what could be wrong here?
>>>
>>> regards,
>>> HANS
>>>
>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Patrick Linskey [mailto:plinskey@bea.com]
>>>> Gesendet: Freitag, 23. Februar 2007 18:46
>>>> An: open-jpa-dev@incubator.apache.org
>>>> Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
>>>> [architecture]
>>>>
>>>> Typo indeed. It should be
>>> OpenJPAPersistence.toBrokerFactory(emf). Sorry
>>>> about that.
>>>>
>>>> -Patrick
>>>>
>>>> --
>>>> Patrick Linskey
>>>> BEA Systems, Inc.
>>>>
>>>>
>>> ______________________________________________________________
>>> _________
>>>> Notice:  This email message, together with any attachments,
>>> may contain
>>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>>  affiliated
>>>> entities,  that may be confidential,  proprietary,
>>> copyrighted  and/or
>>>> legally privileged, and is intended solely for the use of
>>> the individual
>>>> or entity named in this message. If you are not the
>>> intended recipient,
>>>> and have received this message in error, please immediately
>>> return this
>>>> by email and then delete it.
>>>>
>>>>> -----Original Message-----
>>>>> From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
>>>>> Sent: Friday, February 23, 2007 9:43 AM
>>>>> To: open-jpa-dev@incubator.apache.org
>>>>> Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session  
>>>>> beans?
>>>>> [architecture]
>>>>>
>>>>> Patrick,
>>>>>
>>>>> I'm currently trying your tip with a PersistenceService util class
>>>>> doing the lookup of a synchronized entity manager. The problem is
>>>>> that your sample code does not work!
>>>>>
>>>>> in fact the statement
>>>>>
>>>>> final BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>>
>>>>> is the problem. the above "cast" does not return a BrokerFactory
>>>>> instance!
>>>>>
>>>>> I am using a 2 days old nightly snapshot 0.9.7 build
>>>>>
>>>>> Where is the problem?
>>>>>
>>>>> Hans
>>>>>
>>>>>> -----Ursprüngliche Nachricht-----
>>>>>> Von: Patrick Linskey [mailto:plinskey@bea.com]
>>>>>> Gesendet: Donnerstag, 22. Februar 2007 23:22
>>>>>> An: open-jpa-dev@incubator.apache.org
>>>>>> Betreff: RE: RE: Howto integrate JPA within EJB2.1
>>> session beans?
>>>>>> [architecture]
>>>>>>
>>>>>>> Unfortunately, that means that we're using a synchronized block
>>>>>>> during the lookup. If it looks like EM lookup is a scalability
>>>>>>> issue for your app, do let us know -- it would be pretty
>>>>>>> straightforward to replace the synchronized block with a
>>>>>>> concurrent map.
>>>>>>
>>>>>> OK, I got fed up with that synchronized block. OPENJPA-161
>>>>> tracks the
>>>>>> issue; I've got a patch that I'll submit once some more
>>>>> eyes look at it.
>>>>>>
>>>>>> -Patrick
>>>>>>
>>>>>> --
>>>>>> Patrick Linskey
>>>>>> BEA Systems, Inc.
>>>>>>
>>>>>>
>>>>> ______________________________________________________________
>>>>> _________
>>>>>> Notice:  This email message, together with any attachments,
>>>>> may contain
>>>>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>>>>  affiliated
>>>>>> entities,  that may be confidential,  proprietary,
>>>>> copyrighted  and/or
>>>>>> legally privileged, and is intended solely for the use of
>>>>> the individual
>>>>>> or entity named in this message. If you are not the
>>>>> intended recipient,
>>>>>> and have received this message in error, please immediately
>>>>> return this
>>>>>> by email and then delete it.
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Patrick Linskey [mailto:plinskey@bea.com]
>>>>>>> Sent: Thursday, February 22, 2007 8:38 AM
>>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>>> Subject: RE: RE: Howto integrate JPA within EJB2.1 session  
>>>>>>> beans?
>>>>>>> [architecture]
>>>>>>>
>>>>>>>> If I understand it correct, I "just" have to bind the EMF
>>>>>>>> onserver startup like.
>>>>>>>>
>>>>>>>> context.bind("my/jndi/name/for/emf",myEMFVariable);
>>>>>>>
>>>>>>> Yep.
>>>>>>>
>>>>>>>>         //does the statement below again create a NEW EMF
>>>>>>> or ist this
>>>>>>>>         //just a lookup in the jndi-tree? but why is it called
>>>>>>>> "Create"
>>>>>>>>         //and not get?
>>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>>             .createEntityManagerFactory(
>>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>>
>>>>>>> It's just a lookup. I'm not sure why it's called
>>> 'create'. Anyone?
>>>>>>>
>>>>>>>>         //why do I have to create a new
>>>>>>> broker/entitymanager this way?
>>>>>>>>         //is this because I have to "synchronize" the SLSBs
>>>>>>>> transaction
>>>>>>>>         //context with the newly created entitymanager?
>>>>>>>
>>>>>>> Yes -- our current OpenJPAPersistence EM lookup methods
>>>>> all create new
>>>>>>> EMs. The broker code will look up one associated with
>>> the current
>>>>>>> transaction, which is what you're looking for.
>>>>>>>
>>>>>>> Unfortunately, that means that we're using a synchronized
>>>>> block during
>>>>>>> the lookup. If it looks like EM lookup is a scalability
>>>>> issue for your
>>>>>>> app, do let us know -- it would be pretty straightforward to
>>>>>>> replace the synchronized block with a concurrent map.
>>>>>>>
>>>>>>>> So if understand that right I just would have to call
>>>>>>>>
>>>>>>>> PersistenceService.getEntitymanager();
>>>>>>>>
>>>>>>>> in every SLSB method (NOT in ejbCreate) when needed? fine.
>>>>>>>
>>>>>>> Yep.
>>>>>>>
>>>>>>>> I really appreciate your help - it's quite complex
>>> to integrate
>>>>>>>> JPA into an existing Java2EE 1.4 AppServer
>>> environment.. *puh*
>>>>>>>
>>>>>>> Yes -- sorry about that. We should at least be creating
>>>>>>> better-designed helper methods in OpenJPA to help out with this.
>>>>>>>
>>>>>>> One alternative, of course, is to use Spring 2, which does a
>>>>>>> pretty good job of JPA bootstrapping.
>>>>>>>
>>>>>>> -Patrick
>>>>>>>
>>>>>>> --
>>>>>>> Patrick Linskey
>>>>>>> BEA Systems, Inc.
>>>>>>>
>>>>>>> ______________________________________________________________
>>>>>>> _________
>>>>>>> Notice:  This email message, together with any attachments, may
>>>>>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
>>>>>>> and affiliated entities,  that may be confidential,   
>>>>>>> proprietary,
>>>>>>> copyrighted  and/or legally privileged, and is intended solely
>>>>>>> for the use of the individual or entity named in this  
>>>>>>> message. If
>>>>>>> you are not the intended recipient, and have received this
>>>>>>> message in error, please immediately return this by email and
>>>>>>> then delete it.
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Hans Prueller [mailto:hans.prueller@gmx.net]
>>>>>>>> Sent: Thursday, February 22, 2007 4:36 AM
>>>>>>>> To: open-jpa-dev@incubator.apache.org;
>>>>>>>> open-jpa-dev@incubator.apache.org
>>>>>>>> Subject: Re: RE: Howto integrate JPA within EJB2.1 session
>>>>>>>> beans? [architecture]
>>>>>>>>
>>>>>>>> Patrick,
>>>>>>>>
>>>>>>>> thank you for that tip. To be true, I was not aware of  
>>>>>>>> lifecycle
>>>>>>>> related problems between my SLSBs and JPA - thank you for that
>>>>>>>> hint. As I want to avoid working with ThreadLocal (simply
>>>>>>>> because I didn't work with ThreadLocals
>>>>>>>> yet) I would prefer the JNDI-EMF based approach.
>>>>>>>>
>>>>>>>> If I understand it correct, I "just" have to bind the EMF
>>>>>>>> onserver startup like.
>>>>>>>>
>>>>>>>> context.bind("my/jndi/name/for/emf",myEMFVariable);
>>>>>>>>
>>>>>>>> I would be interested what the code for the PersistenceService
>>>>>>>> class does:
>>>>>>>>
>>>>>>>>
>>>>>>>>         //does the statement below again create a NEW EMF
>>>>>>> or ist this
>>>>>>>>         //just a lookup in the jndi-tree? but why is it called
>>>>>>>> "Create"
>>>>>>>>         //and not get?
>>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>>             .createEntityManagerFactory(
>>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>>>
>>>>>>>>         //why do i have to cast the EMF to a
>>>>> brokerfactory now? I
>>>>>>>>         //would guess the "broker" is something like a
>>>>> more abstract
>>>>>>>>         //concept of entitymanager(factory)?
>>>>>>>>
>>>>>>>>         //why do I have to create a new
>>>>>>> broker/entitymanager this way?
>>>>>>>>         //is this because I have to "synchronize" the SLSBs
>>>>>>>> transaction
>>>>>>>>         //context with the newly created entitymanager?
>>>>>>>>
>>>>>>>>         BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>>>>>         Broker b = bf.newBroker(
>>>>>>>>         bf.getConfiguration().getConnectionUserName(),
>>>>>>>>           bf.getConfiguration().getConnectionPassword(),
>>>>>>>>           true, // the broker is part of a JTA managed tx
>>>>>>>>
>>>>> bf.getConfiguration().getConnectionRetainModeConstant(),
>>>>>>>>           true); // look for an existing Broker on the tx
>>>>>>>>
>>>>>>>>         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
>>>>>>>>
>>> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
>>>>>>>>         broker.setDetachedNew(false);
>>>>>>>>
>>>>>>>>         return OpenJPAPersistence.toEntityManager(b);
>>>>>>>>     }
>>>>>>>>
>>>>>>>> So if understand that right I just would have to call
>>>>>>>>
>>>>>>>> PersistenceService.getEntitymanager();
>>>>>>>>
>>>>>>>> in every SLSB method (NOT in ejbCreate) when needed? fine. I
>>>>>>>> really appreciate your help - it's quite complex to
>>> integrate
>>>>>>>> JPA into an existing Java2EE 1.4 AppServer
>>> environment.. *puh*
>>>>>>>>
>>>>>>>> regards
>>>>>>>> Hans
>>>>>>>>
>>>>>>>> -------- Original-Nachricht --------
>>>>>>>> Datum: Wed, 21 Feb 2007 08:43:20 -0800
>>>>>>>> Von: "Patrick Linskey" <pl...@bea.com>
>>>>>>>> An: open-jpa-dev@incubator.apache.org
>>>>>>>> CC:
>>>>>>>> Betreff: RE: Howto integrate JPA within EJB2.1
>>> session beans?
>>>>>>>> [architecture]
>>>>>>>>
>>>>>>>>> Another common technique is to get an EMF into
>>> JNDI, either
>>>>>>>> by using a
>>>>>>>>> startup hook or deploying OpenJPA as a JCA RAR.
>>>>>>>>>
>>>>>>>>> Are you looking to integrate OpenJPA with your
>>> current managed
>>>>>>>>> transaction? If so, I'd be careful about creating an EM in
>>>>>>>> ejbCreate(),
>>>>>>>>> as its lifecycle is related to the life of the SLSB,
>>>>> not to the
>>>>>>>>> transactional context (the SLSB might be pooled). So, I'd
>>>>>>>> just try to
>>>>>>>>> get the EMF into JNDI when the server starts
>>> (creating EMFs
>>>>>>>> is slow).
>>>>>>>>> Then, you could avoid having to use your own ThreadLocal
>>>>>>>> work by using
>>>>>>>>> the internal OpenJPA BrokerFactory APIs:
>>>>>>>>>
>>>>>>>>> public class PersistenceService {
>>>>>>>>>     public static EntityManager getEntityManager() {
>>>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>>>             .createEntityManagerFactory(
>>>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>>>>         BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>>>>>>         Broker b = bf.newBroker(
>>>>>>>>>             bf.getConfiguration().getConnectionUserName(),
>>>>>>>>>             bf.getConfiguration().getConnectionPassword(),
>>>>>>>>>             true, // the broker is part of a JTA
>>> managed tx
>>>>>>>>>
>>>>>>> bf.getConfiguration().getConnectionRetainModeConstant(),
>>>>>>>>>             true); // look for an existing Broker
>>> on the tx
>>>>>>>>>
>>>>>>>>>         // do some JPA configuration setup. Logic
>>> stolen from
>>>>>>>>>         // EntityManagerFactoryImpl.
>>>>>>>>>
>>> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
>>>>>>>>>
>>>>> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
>>>>>>>>>         broker.setDetachedNew(false);
>>>>>>>>>
>>>>>>>>>         return OpenJPAPersistence.toEntityManager(b);
>>>>>>>>>     }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> Meanwhile, we really should add a couple new
>>>>> OpenJPAPersistence /
>>>>>>>>> OpenJPAEntityManagerFactory methods to help out with
>>>>> this type of
>>>>>>>>> bootstrapping.
>>>>>>>>>
>>>>>>>>> -Patrick
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Patrick Linskey
>>>>>>>>> BEA Systems, Inc.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>> ______________________________________________________________
>>>>>>>> _________
>>>>>>>>> Notice:  This email message, together with any
>>> attachments,
>>>>>>>> may contain
>>>>>>>>> information  of  BEA Systems,  Inc.,  its
>>> subsidiaries  and
>>>>>>>>  affiliated
>>>>>>>>> entities,  that may be confidential,  proprietary,
>>>>>>>> copyrighted  and/or
>>>>>>>>> legally privileged, and is intended solely for the use of
>>>>>>>> the individual
>>>>>>>>> or entity named in this message. If you are not the
>>>>>>>> intended recipient,
>>>>>>>>> and have received this message in error, please
>>> immediately
>>>>>>>> return this
>>>>>>>>> by email and then delete it.
>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Hans Prueller [mailto:hans.prueller@gmx.net]
>>>>>>>>>> Sent: Wednesday, February 21, 2007 1:02 AM
>>>>>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>>>>>> Subject: Howto integrate JPA within EJB2.1
>>> session beans?
>>>>>>>>>> [architecture]
>>>>>>>>>>
>>>>>>>>>> Hi together,
>>>>>>>>>>
>>>>>>>>>> I'm sorry for bothering you with numerous basic
>>> questions
>>>>>>>>>> regarding OpenJPA and its usage but I have to migrate  
>>>>>>>>>> existing
>>>>>>>>>> CMP EJBs to migrate within short time
>>> to OpenJPA as
>>>>>>>>>> we're having stability issues with the current
>>> CMP engine.
>>>>>>>>>>
>>>>>>>>>> One last question I'd like to ask is regarding the  
>>>>>>>>>> recommended
>>>>>>>>>> architecture of using OpenJPA within EJB2.1 Stateless sessino
>>>>>>>>>> beans:
>>>>>>>>>>
>>>>>>>>>> I need to work with persistence i.e. the EntityManager
>>>>>>>>>> throughout all the session beans methods so my
>>> idea is to:
>>>>>>>>>>
>>>>>>>>>> - create a EntityManagerFactory in the
>>> ejbCreate() method
>>>>>>>> of the SLSB
>>>>>>>>>> - and also create the EntityManager itself in the
>>>>>>>>>> ejbCreeate() method and store it as a member variable
>>>>>>> of the SLSB
>>>>>>>>>> - this would allow easy access within the SB's
>>> methods by
>>>>>>>>>> just using the already initialized entity
>>> manager varialbe
>>>>>>>>>> em.createNamedQuery() .. etc. etc.
>>>>>>>>>> - clean up should be performed in the ejbRemove() method
>>>>>>>> of the SLSB
>>>>>>>>>>
>>>>>>>>>> I think doing so will allow migratino to
>>> openJPA with less
>>>>>>>>>> work than doing the whole lookup procedure in
>>> every method
>>>>>>>>>> separately.
>>>>>>>>>>
>>>>>>>>>> what do you think? are there any pitfalls i've
>>> overlooked?
>>>>>>>>>>
>>>>>>>>>> thank you for your ideas!
>>>>>>>>>>
>>>>>>>>>> regards
>>>>>>>>>> Hans
>>>>>>>>>> --
>>>>>>>>>> "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
>>>>>>>>>> Jetzt GMX ProMail testen:
>>>>>>> www.gmx.net/de/go/mailfooter/promail-out
>>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
>>>>>>>> Jetzt GMX ProMail testen:
>>>>> www.gmx.net/de/go/mailfooter/promail-out
>>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com P.S. A good JDO? O, Gasp!
>
> ______________________________________________________________________ 
> _
> Notice:  This email message, together with any attachments, may  
> contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and   
> affiliated
> entities,  that may be confidential,  proprietary,  copyrighted   
> and/or
> legally privileged, and is intended solely for the use of the  
> individual
> or entity named in this message. If you are not the intended  
> recipient,
> and have received this message in error, please immediately return  
> this
> by email and then delete it.

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Pinaki Poddar <pp...@bea.com>.
The JNDI spec says:  "the container knows that the application can't change the state of the object." 
How does one tell the container that the JNDI-bound instance is one such 'application immutable' object?

> What we ended up with was implementing the naming.Referenceable interface
Did the JDO solution defined its own javax.naming.spi.ObjectFactory to take control of how JNDI-bound instances are created on lookup?



Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM] 
Sent: Tuesday, February 27, 2007 3:32 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

We had a similar issue with the JDO Reference Implementation. What we ended up with was implementing the naming.Referenceable interface and writing our own externalization protocols that basically allowed the container to create new instances of our Factory that were actually trivial wrappers that delegated to the real Factory.

So yes, I believe that unless a container "knows" that a bound value is actually sharable (see below), it will generally serialize the instance and then deserialize it for each caller. The way to make this operation perform well (short of telling the container to share
it) is to implement the Referenceable contracts.

I can drag out more details if there is interest. Or you can look at the implementation of FOStorePMF in the Apache JDO project.

Craig

On Feb 27, 2007, at 9:47 AM, Pinaki Poddar wrote:

>> But maybe something funky is happening with JNDI serializing the 
>> factory and then deserializing it or something.
>
> From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and Directory
> Interface:
>
> In general, lookups of objects in the JNDI java: namespace are 
> required to return a new instance of the requested object every time. 
> Exceptions are allowed for the following:
> - The container knows the object is immutable (for example, objects of 
> type java.lang.String), or knows that the application can't change the 
> state of the object.
> -The object is defined to be a singleton, such that only one instance 
> of the object may exist in the JVM.
> -The name used for the lookup is defined to return an instance of the 
> object that might be shared. The name java:comp/ORB is such a name.
>
> In these cases, a shared instance of the object may be returned. In 
> all other cases, a new instance of the requested object must be 
> returned on each lookup.
>
>
> Pinaki Poddar
> BEA Systems
> 415.402.7317
>
>
> -----Original Message-----
> From: Patrick Linskey [mailto:plinskey@bea.com]
> Sent: Monday, February 26, 2007 11:11 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: EMF JNDI lookup is starting openJPA every time - was:  
> Howto integrate JPA within EJB2.1 session beans?
>
> It should be going through the following code:
>
>     public static OpenJPAEntityManagerFactory 
> createEntityManagerFactory
>         (String jndiLocation, Context context) {
>         if (jndiLocation == null)
>             throw new NullPointerException("jndiLocation == null");
>
>         try {
>             if (context == null)
>                 context = new InitialContext();
>
>             Object o = context.lookup(jndiLocation);
>             return (OpenJPAEntityManagerFactory) 
> PortableRemoteObject.narrow(o,
>                 OpenJPAEntityManagerFactory.class);
>         } catch (NamingException ne) {
>             throw new ArgumentException(_loc.get("naming-exception",
>                 jndiLocation), new Throwable[]{ ne }, null, true);
>         }
>     }
>
> I don't see anything in there that would be causing a creation to 
> happen. But maybe something funky is happening with JNDI serializing 
> the factory and then deserializing it or something.
>
> Do you have any means of getting a stack from where the creation is 
> happening? It'd be great to get a bit more context about what's going 
> on.
>
> -Patrick
>
> --
> Patrick Linskey
> BEA Systems, Inc.
>
> ______________________________________________________________________
> _
> Notice:  This email message, together with any attachments, may  
> contain information  of  BEA Systems,  Inc.,  its subsidiaries   
> and  affiliated entities,  that may be confidential,  proprietary,   
> copyrighted  and/or legally privileged, and is intended solely for the 
> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>
>> -----Original Message-----
>> From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
>> Sent: Saturday, February 24, 2007 10:36 PM
>> To: open-jpa-dev@incubator.apache.org
>> Subject: EMF JNDI lookup is starting openJPA every time -
>> was: Howto integrate JPA within EJB2.1 session beans?
>>
>> Hi together, Patrick,
>>
>> the code you suggested for doing a helper method that deals with the 
>> EMF JNDI lookup and the EM creating within our J2EE1.4 app basically 
>> works fine, but as you perhaps may remember I asked why the method is 
>> called "create":
>>
>> EntityManagerFactory myemf =
>> OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
>> (Context)null);
>>
>> It seems that the method above really creates a NEW EMF on every 
>> invocation!
>> I checked the logs of my application and I see the following messages 
>> on every invocation of my PersistenceService.getEntityManger()
>> method (which
>> does the above lookup and some more ..)
>>
>> 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
>> : creating a
>> fresh
>> , clean EntityManager from JNDI EMF.
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.Runtime -
>> Starti
>> ng OpenJPA 0.9.7-incubating-SNAPSHOT
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.jdbc.JDBC -
>> Open
>> JPA will now connect to the database to attempt to determine what 
>> type of databa se dictionary to use.  To prevent this connection in 
>> the future, set your openjp a.jdbc.DBDictionary configuration 
>> property to the appropriate value for your dat abase (see the 
>> documentation for available values).
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.jdbc.JDBC -
>> Usin
>> g dictionary class
>> "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c 
>> ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
>> 2006-10-19
>>  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.MetaData -
>> Found
>>  1 classes with metadata in 0 milliseconds.
>>
>>
>> It seems that OpenJPA is now bootstrapping everytime I access it.  
>> I am
>> binding the EMF somewhen at bootstrapping time with
>>
>> final EntityManagerFactory emFactory = Persistence
>> 				.createEntityManagerFactory("lbsims");
>>
>> Context ictx = new InitialContext();
>> ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
>>
>> The lookup uses the same constants, so the EMF in JNDI should be 
>> found?
>>
>> EntityManagerFactory emf = OpenJPAPersistence
>> 	
>> .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
>>
>> Any Idea what could be wrong here?
>>
>> regards,
>> HANS
>>
>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Patrick Linskey [mailto:plinskey@bea.com]
>>> Gesendet: Freitag, 23. Februar 2007 18:46
>>> An: open-jpa-dev@incubator.apache.org
>>> Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
>>> [architecture]
>>>
>>> Typo indeed. It should be
>> OpenJPAPersistence.toBrokerFactory(emf). Sorry
>>> about that.
>>>
>>> -Patrick
>>>
>>> --
>>> Patrick Linskey
>>> BEA Systems, Inc.
>>>
>>>
>> ______________________________________________________________
>> _________
>>> Notice:  This email message, together with any attachments,
>> may contain
>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>  affiliated
>>> entities,  that may be confidential,  proprietary,
>> copyrighted  and/or
>>> legally privileged, and is intended solely for the use of
>> the individual
>>> or entity named in this message. If you are not the
>> intended recipient,
>>> and have received this message in error, please immediately
>> return this
>>> by email and then delete it.
>>>
>>>> -----Original Message-----
>>>> From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
>>>> Sent: Friday, February 23, 2007 9:43 AM
>>>> To: open-jpa-dev@incubator.apache.org
>>>> Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session beans? 
>>>> [architecture]
>>>>
>>>> Patrick,
>>>>
>>>> I'm currently trying your tip with a PersistenceService util class 
>>>> doing the lookup of a synchronized entity manager. The problem is 
>>>> that your sample code does not work!
>>>>
>>>> in fact the statement
>>>>
>>>> final BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>
>>>> is the problem. the above "cast" does not return a BrokerFactory 
>>>> instance!
>>>>
>>>> I am using a 2 days old nightly snapshot 0.9.7 build
>>>>
>>>> Where is the problem?
>>>>
>>>> Hans
>>>>
>>>>> -----Ursprüngliche Nachricht-----
>>>>> Von: Patrick Linskey [mailto:plinskey@bea.com]
>>>>> Gesendet: Donnerstag, 22. Februar 2007 23:22
>>>>> An: open-jpa-dev@incubator.apache.org
>>>>> Betreff: RE: RE: Howto integrate JPA within EJB2.1
>> session beans?
>>>>> [architecture]
>>>>>
>>>>>> Unfortunately, that means that we're using a synchronized block 
>>>>>> during the lookup. If it looks like EM lookup is a scalability 
>>>>>> issue for your app, do let us know -- it would be pretty 
>>>>>> straightforward to replace the synchronized block with a 
>>>>>> concurrent map.
>>>>>
>>>>> OK, I got fed up with that synchronized block. OPENJPA-161
>>>> tracks the
>>>>> issue; I've got a patch that I'll submit once some more
>>>> eyes look at it.
>>>>>
>>>>> -Patrick
>>>>>
>>>>> --
>>>>> Patrick Linskey
>>>>> BEA Systems, Inc.
>>>>>
>>>>>
>>>> ______________________________________________________________
>>>> _________
>>>>> Notice:  This email message, together with any attachments,
>>>> may contain
>>>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>>>  affiliated
>>>>> entities,  that may be confidential,  proprietary,
>>>> copyrighted  and/or
>>>>> legally privileged, and is intended solely for the use of
>>>> the individual
>>>>> or entity named in this message. If you are not the
>>>> intended recipient,
>>>>> and have received this message in error, please immediately
>>>> return this
>>>>> by email and then delete it.
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Patrick Linskey [mailto:plinskey@bea.com]
>>>>>> Sent: Thursday, February 22, 2007 8:38 AM
>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>> Subject: RE: RE: Howto integrate JPA within EJB2.1 session beans? 
>>>>>> [architecture]
>>>>>>
>>>>>>> If I understand it correct, I "just" have to bind the EMF 
>>>>>>> onserver startup like.
>>>>>>>
>>>>>>> context.bind("my/jndi/name/for/emf",myEMFVariable);
>>>>>>
>>>>>> Yep.
>>>>>>
>>>>>>>         //does the statement below again create a NEW EMF
>>>>>> or ist this
>>>>>>>         //just a lookup in the jndi-tree? but why is it called 
>>>>>>> "Create"
>>>>>>>         //and not get?
>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>             .createEntityManagerFactory(
>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>
>>>>>> It's just a lookup. I'm not sure why it's called
>> 'create'. Anyone?
>>>>>>
>>>>>>>         //why do I have to create a new
>>>>>> broker/entitymanager this way?
>>>>>>>         //is this because I have to "synchronize" the SLSBs 
>>>>>>> transaction
>>>>>>>         //context with the newly created entitymanager?
>>>>>>
>>>>>> Yes -- our current OpenJPAPersistence EM lookup methods
>>>> all create new
>>>>>> EMs. The broker code will look up one associated with
>> the current
>>>>>> transaction, which is what you're looking for.
>>>>>>
>>>>>> Unfortunately, that means that we're using a synchronized
>>>> block during
>>>>>> the lookup. If it looks like EM lookup is a scalability
>>>> issue for your
>>>>>> app, do let us know -- it would be pretty straightforward to 
>>>>>> replace the synchronized block with a concurrent map.
>>>>>>
>>>>>>> So if understand that right I just would have to call
>>>>>>>
>>>>>>> PersistenceService.getEntitymanager();
>>>>>>>
>>>>>>> in every SLSB method (NOT in ejbCreate) when needed? fine.
>>>>>>
>>>>>> Yep.
>>>>>>
>>>>>>> I really appreciate your help - it's quite complex
>> to integrate
>>>>>>> JPA into an existing Java2EE 1.4 AppServer
>> environment.. *puh*
>>>>>>
>>>>>> Yes -- sorry about that. We should at least be creating 
>>>>>> better-designed helper methods in OpenJPA to help out with this.
>>>>>>
>>>>>> One alternative, of course, is to use Spring 2, which does a 
>>>>>> pretty good job of JPA bootstrapping.
>>>>>>
>>>>>> -Patrick
>>>>>>
>>>>>> --
>>>>>> Patrick Linskey
>>>>>> BEA Systems, Inc.
>>>>>>
>>>>>> ______________________________________________________________
>>>>>> _________
>>>>>> Notice:  This email message, together with any attachments, may 
>>>>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries  
>>>>>> and affiliated entities,  that may be confidential,  proprietary, 
>>>>>> copyrighted  and/or legally privileged, and is intended solely 
>>>>>> for the use of the individual or entity named in this message. If 
>>>>>> you are not the intended recipient, and have received this 
>>>>>> message in error, please immediately return this by email and 
>>>>>> then delete it.
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Hans Prueller [mailto:hans.prueller@gmx.net]
>>>>>>> Sent: Thursday, February 22, 2007 4:36 AM
>>>>>>> To: open-jpa-dev@incubator.apache.org;
>>>>>>> open-jpa-dev@incubator.apache.org
>>>>>>> Subject: Re: RE: Howto integrate JPA within EJB2.1 session 
>>>>>>> beans? [architecture]
>>>>>>>
>>>>>>> Patrick,
>>>>>>>
>>>>>>> thank you for that tip. To be true, I was not aware of lifecycle 
>>>>>>> related problems between my SLSBs and JPA - thank you for that 
>>>>>>> hint. As I want to avoid working with ThreadLocal (simply 
>>>>>>> because I didn't work with ThreadLocals
>>>>>>> yet) I would prefer the JNDI-EMF based approach.
>>>>>>>
>>>>>>> If I understand it correct, I "just" have to bind the EMF 
>>>>>>> onserver startup like.
>>>>>>>
>>>>>>> context.bind("my/jndi/name/for/emf",myEMFVariable);
>>>>>>>
>>>>>>> I would be interested what the code for the PersistenceService 
>>>>>>> class does:
>>>>>>>
>>>>>>>
>>>>>>>         //does the statement below again create a NEW EMF
>>>>>> or ist this
>>>>>>>         //just a lookup in the jndi-tree? but why is it called 
>>>>>>> "Create"
>>>>>>>         //and not get?
>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>             .createEntityManagerFactory(
>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>>
>>>>>>>         //why do i have to cast the EMF to a
>>>> brokerfactory now? I
>>>>>>>         //would guess the "broker" is something like a
>>>> more abstract
>>>>>>>         //concept of entitymanager(factory)?
>>>>>>>
>>>>>>>         //why do I have to create a new
>>>>>> broker/entitymanager this way?
>>>>>>>         //is this because I have to "synchronize" the SLSBs 
>>>>>>> transaction
>>>>>>>         //context with the newly created entitymanager?
>>>>>>>
>>>>>>>         BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>>>>         Broker b = bf.newBroker(
>>>>>>>         bf.getConfiguration().getConnectionUserName(),
>>>>>>>           bf.getConfiguration().getConnectionPassword(),
>>>>>>>           true, // the broker is part of a JTA managed tx
>>>>>>>
>>>> bf.getConfiguration().getConnectionRetainModeConstant(),
>>>>>>>           true); // look for an existing Broker on the tx
>>>>>>>
>>>>>>>         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
>>>>>>>
>> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
>>>>>>>         broker.setDetachedNew(false);
>>>>>>>
>>>>>>>         return OpenJPAPersistence.toEntityManager(b);
>>>>>>>     }
>>>>>>>
>>>>>>> So if understand that right I just would have to call
>>>>>>>
>>>>>>> PersistenceService.getEntitymanager();
>>>>>>>
>>>>>>> in every SLSB method (NOT in ejbCreate) when needed? fine. I 
>>>>>>> really appreciate your help - it's quite complex to
>> integrate
>>>>>>> JPA into an existing Java2EE 1.4 AppServer
>> environment.. *puh*
>>>>>>>
>>>>>>> regards
>>>>>>> Hans
>>>>>>>
>>>>>>> -------- Original-Nachricht --------
>>>>>>> Datum: Wed, 21 Feb 2007 08:43:20 -0800
>>>>>>> Von: "Patrick Linskey" <pl...@bea.com>
>>>>>>> An: open-jpa-dev@incubator.apache.org
>>>>>>> CC:
>>>>>>> Betreff: RE: Howto integrate JPA within EJB2.1
>> session beans?
>>>>>>> [architecture]
>>>>>>>
>>>>>>>> Another common technique is to get an EMF into
>> JNDI, either
>>>>>>> by using a
>>>>>>>> startup hook or deploying OpenJPA as a JCA RAR.
>>>>>>>>
>>>>>>>> Are you looking to integrate OpenJPA with your
>> current managed
>>>>>>>> transaction? If so, I'd be careful about creating an EM in
>>>>>>> ejbCreate(),
>>>>>>>> as its lifecycle is related to the life of the SLSB,
>>>> not to the
>>>>>>>> transactional context (the SLSB might be pooled). So, I'd
>>>>>>> just try to
>>>>>>>> get the EMF into JNDI when the server starts
>> (creating EMFs
>>>>>>> is slow).
>>>>>>>> Then, you could avoid having to use your own ThreadLocal
>>>>>>> work by using
>>>>>>>> the internal OpenJPA BrokerFactory APIs:
>>>>>>>>
>>>>>>>> public class PersistenceService {
>>>>>>>>     public static EntityManager getEntityManager() {
>>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>>             .createEntityManagerFactory(
>>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>>>         BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>>>>>         Broker b = bf.newBroker(
>>>>>>>>             bf.getConfiguration().getConnectionUserName(),
>>>>>>>>             bf.getConfiguration().getConnectionPassword(),
>>>>>>>>             true, // the broker is part of a JTA
>> managed tx
>>>>>>>>
>>>>>> bf.getConfiguration().getConnectionRetainModeConstant(),
>>>>>>>>             true); // look for an existing Broker
>> on the tx
>>>>>>>>
>>>>>>>>         // do some JPA configuration setup. Logic
>> stolen from
>>>>>>>>         // EntityManagerFactoryImpl.
>>>>>>>>
>> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
>>>>>>>>
>>>> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
>>>>>>>>         broker.setDetachedNew(false);
>>>>>>>>
>>>>>>>>         return OpenJPAPersistence.toEntityManager(b);
>>>>>>>>     }
>>>>>>>> }
>>>>>>>>
>>>>>>>> Meanwhile, we really should add a couple new
>>>> OpenJPAPersistence /
>>>>>>>> OpenJPAEntityManagerFactory methods to help out with
>>>> this type of
>>>>>>>> bootstrapping.
>>>>>>>>
>>>>>>>> -Patrick
>>>>>>>>
>>>>>>>> --
>>>>>>>> Patrick Linskey
>>>>>>>> BEA Systems, Inc.
>>>>>>>>
>>>>>>>>
>>>>>>>
>> ______________________________________________________________
>>>>>>> _________
>>>>>>>> Notice:  This email message, together with any
>> attachments,
>>>>>>> may contain
>>>>>>>> information  of  BEA Systems,  Inc.,  its
>> subsidiaries  and
>>>>>>>  affiliated
>>>>>>>> entities,  that may be confidential,  proprietary,
>>>>>>> copyrighted  and/or
>>>>>>>> legally privileged, and is intended solely for the use of
>>>>>>> the individual
>>>>>>>> or entity named in this message. If you are not the
>>>>>>> intended recipient,
>>>>>>>> and have received this message in error, please
>> immediately
>>>>>>> return this
>>>>>>>> by email and then delete it.
>>>>>>>>
>>>>>>>>> -----Original Message-----
>>>>>>>>> From: Hans Prueller [mailto:hans.prueller@gmx.net]
>>>>>>>>> Sent: Wednesday, February 21, 2007 1:02 AM
>>>>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>>>>> Subject: Howto integrate JPA within EJB2.1
>> session beans?
>>>>>>>>> [architecture]
>>>>>>>>>
>>>>>>>>> Hi together,
>>>>>>>>>
>>>>>>>>> I'm sorry for bothering you with numerous basic
>> questions
>>>>>>>>> regarding OpenJPA and its usage but I have to migrate existing 
>>>>>>>>> CMP EJBs to migrate within short time
>> to OpenJPA as
>>>>>>>>> we're having stability issues with the current
>> CMP engine.
>>>>>>>>>
>>>>>>>>> One last question I'd like to ask is regarding the recommended 
>>>>>>>>> architecture of using OpenJPA within EJB2.1 Stateless sessino 
>>>>>>>>> beans:
>>>>>>>>>
>>>>>>>>> I need to work with persistence i.e. the EntityManager 
>>>>>>>>> throughout all the session beans methods so my
>> idea is to:
>>>>>>>>>
>>>>>>>>> - create a EntityManagerFactory in the
>> ejbCreate() method
>>>>>>> of the SLSB
>>>>>>>>> - and also create the EntityManager itself in the
>>>>>>>>> ejbCreeate() method and store it as a member variable
>>>>>> of the SLSB
>>>>>>>>> - this would allow easy access within the SB's
>> methods by
>>>>>>>>> just using the already initialized entity
>> manager varialbe
>>>>>>>>> em.createNamedQuery() .. etc. etc.
>>>>>>>>> - clean up should be performed in the ejbRemove() method
>>>>>>> of the SLSB
>>>>>>>>>
>>>>>>>>> I think doing so will allow migratino to
>> openJPA with less
>>>>>>>>> work than doing the whole lookup procedure in
>> every method
>>>>>>>>> separately.
>>>>>>>>>
>>>>>>>>> what do you think? are there any pitfalls i've
>> overlooked?
>>>>>>>>>
>>>>>>>>> thank you for your ideas!
>>>>>>>>>
>>>>>>>>> regards
>>>>>>>>> Hans
>>>>>>>>> --
>>>>>>>>> "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
>>>>>>>>> Jetzt GMX ProMail testen:
>>>>>> www.gmx.net/de/go/mailfooter/promail-out
>>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
>>>>>>> Jetzt GMX ProMail testen:
>>>> www.gmx.net/de/go/mailfooter/promail-out
>>>>>>>
>>>>>>
>>>>
>>>>
>>
>>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com P.S. A good JDO? O, Gasp!

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Re: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Craig L Russell <Cr...@Sun.COM>.
We had a similar issue with the JDO Reference Implementation. What we  
ended up with was implementing the naming.Referenceable interface and  
writing our own externalization protocols that basically allowed the  
container to create new instances of our Factory that were actually  
trivial wrappers that delegated to the real Factory.

So yes, I believe that unless a container "knows" that a bound value  
is actually sharable (see below), it will generally serialize the  
instance and then deserialize it for each caller. The way to make  
this operation perform well (short of telling the container to share  
it) is to implement the Referenceable contracts.

I can drag out more details if there is interest. Or you can look at  
the implementation of FOStorePMF in the Apache JDO project.

Craig

On Feb 27, 2007, at 9:47 AM, Pinaki Poddar wrote:

>> But maybe something funky is happening with JNDI serializing the  
>> factory and then deserializing it or something.
>
> From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and Directory  
> Interface:
>
> In general, lookups of objects in the JNDI java: namespace are  
> required to return a new instance of the requested object every  
> time. Exceptions are
> allowed for the following:
> - The container knows the object is immutable (for example, objects  
> of type java.lang.String), or knows that the application can't  
> change the state of
> the object.
> -The object is defined to be a singleton, such that only one  
> instance of the object may exist in the JVM.
> -The name used for the lookup is defined to return an instance of  
> the object that might be shared. The name java:comp/ORB is such a  
> name.
>
> In these cases, a shared instance of the object may be returned. In  
> all other cases, a new instance of the requested object must be  
> returned on each
> lookup.
>
>
> Pinaki Poddar
> BEA Systems
> 415.402.7317
>
>
> -----Original Message-----
> From: Patrick Linskey [mailto:plinskey@bea.com]
> Sent: Monday, February 26, 2007 11:11 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: EMF JNDI lookup is starting openJPA every time - was:  
> Howto integrate JPA within EJB2.1 session beans?
>
> It should be going through the following code:
>
>     public static OpenJPAEntityManagerFactory  
> createEntityManagerFactory
>         (String jndiLocation, Context context) {
>         if (jndiLocation == null)
>             throw new NullPointerException("jndiLocation == null");
>
>         try {
>             if (context == null)
>                 context = new InitialContext();
>
>             Object o = context.lookup(jndiLocation);
>             return (OpenJPAEntityManagerFactory)  
> PortableRemoteObject.narrow(o,
>                 OpenJPAEntityManagerFactory.class);
>         } catch (NamingException ne) {
>             throw new ArgumentException(_loc.get("naming-exception",
>                 jndiLocation), new Throwable[]{ ne }, null, true);
>         }
>     }
>
> I don't see anything in there that would be causing a creation to  
> happen. But maybe something funky is happening with JNDI  
> serializing the factory and then deserializing it or something.
>
> Do you have any means of getting a stack from where the creation is  
> happening? It'd be great to get a bit more context about what's  
> going on.
>
> -Patrick
>
> --
> Patrick Linskey
> BEA Systems, Inc.
>
> ______________________________________________________________________ 
> _
> Notice:  This email message, together with any attachments, may  
> contain information  of  BEA Systems,  Inc.,  its subsidiaries   
> and  affiliated entities,  that may be confidential,  proprietary,   
> copyrighted  and/or legally privileged, and is intended solely for  
> the use of the individual or entity named in this message. If you  
> are not the intended recipient, and have received this message in  
> error, please immediately return this by email and then delete it.
>
>> -----Original Message-----
>> From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
>> Sent: Saturday, February 24, 2007 10:36 PM
>> To: open-jpa-dev@incubator.apache.org
>> Subject: EMF JNDI lookup is starting openJPA every time -
>> was: Howto integrate JPA within EJB2.1 session beans?
>>
>> Hi together, Patrick,
>>
>> the code you suggested for doing a helper method that deals with the
>> EMF JNDI lookup and the EM creating within our J2EE1.4 app basically
>> works fine, but as you perhaps may remember I asked why the method is
>> called "create":
>>
>> EntityManagerFactory myemf =
>> OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
>> (Context)null);
>>
>> It seems that the method above really creates a NEW EMF on every
>> invocation!
>> I checked the logs of my application and I see the following messages
>> on every invocation of my PersistenceService.getEntityManger()
>> method (which
>> does the above lookup and some more ..)
>>
>> 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
>> : creating a
>> fresh
>> , clean EntityManager from JNDI EMF.
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.Runtime -
>> Starti
>> ng OpenJPA 0.9.7-incubating-SNAPSHOT
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.jdbc.JDBC -
>> Open
>> JPA will now connect to the database to attempt to determine what  
>> type
>> of databa se dictionary to use.  To prevent this connection in the
>> future, set your openjp a.jdbc.DBDictionary configuration property to
>> the appropriate value for your dat abase (see the documentation for
>> available values).
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.jdbc.JDBC -
>> Usin
>> g dictionary class
>> "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c
>> ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
>> 2006-10-19
>>  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
>> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
>> openjpa.MetaData -
>> Found
>>  1 classes with metadata in 0 milliseconds.
>>
>>
>> It seems that OpenJPA is now bootstrapping everytime I access it.  
>> I am
>> binding the EMF somewhen at bootstrapping time with
>>
>> final EntityManagerFactory emFactory = Persistence
>> 				.createEntityManagerFactory("lbsims");
>>
>> Context ictx = new InitialContext();
>> ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
>>
>> The lookup uses the same constants, so the EMF in JNDI should be
>> found?
>>
>> EntityManagerFactory emf = OpenJPAPersistence
>> 	
>> .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
>>
>> Any Idea what could be wrong here?
>>
>> regards,
>> HANS
>>
>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Patrick Linskey [mailto:plinskey@bea.com]
>>> Gesendet: Freitag, 23. Februar 2007 18:46
>>> An: open-jpa-dev@incubator.apache.org
>>> Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
>>> [architecture]
>>>
>>> Typo indeed. It should be
>> OpenJPAPersistence.toBrokerFactory(emf). Sorry
>>> about that.
>>>
>>> -Patrick
>>>
>>> --
>>> Patrick Linskey
>>> BEA Systems, Inc.
>>>
>>>
>> ______________________________________________________________
>> _________
>>> Notice:  This email message, together with any attachments,
>> may contain
>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>  affiliated
>>> entities,  that may be confidential,  proprietary,
>> copyrighted  and/or
>>> legally privileged, and is intended solely for the use of
>> the individual
>>> or entity named in this message. If you are not the
>> intended recipient,
>>> and have received this message in error, please immediately
>> return this
>>> by email and then delete it.
>>>
>>>> -----Original Message-----
>>>> From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
>>>> Sent: Friday, February 23, 2007 9:43 AM
>>>> To: open-jpa-dev@incubator.apache.org
>>>> Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
>>>> beans? [architecture]
>>>>
>>>> Patrick,
>>>>
>>>> I'm currently trying your tip with a PersistenceService util class
>>>> doing the lookup of a synchronized entity manager. The problem is
>>>> that your sample code does not work!
>>>>
>>>> in fact the statement
>>>>
>>>> final BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>
>>>> is the problem. the above "cast" does not return a BrokerFactory
>>>> instance!
>>>>
>>>> I am using a 2 days old nightly snapshot 0.9.7 build
>>>>
>>>> Where is the problem?
>>>>
>>>> Hans
>>>>
>>>>> -----Ursprüngliche Nachricht-----
>>>>> Von: Patrick Linskey [mailto:plinskey@bea.com]
>>>>> Gesendet: Donnerstag, 22. Februar 2007 23:22
>>>>> An: open-jpa-dev@incubator.apache.org
>>>>> Betreff: RE: RE: Howto integrate JPA within EJB2.1
>> session beans?
>>>>> [architecture]
>>>>>
>>>>>> Unfortunately, that means that we're using a synchronized
>>>>>> block during the lookup. If it looks like EM lookup is a
>>>>>> scalability issue for your app, do let us know -- it would be
>>>>>> pretty straightforward to replace the synchronized block with
>>>>>> a concurrent map.
>>>>>
>>>>> OK, I got fed up with that synchronized block. OPENJPA-161
>>>> tracks the
>>>>> issue; I've got a patch that I'll submit once some more
>>>> eyes look at it.
>>>>>
>>>>> -Patrick
>>>>>
>>>>> --
>>>>> Patrick Linskey
>>>>> BEA Systems, Inc.
>>>>>
>>>>>
>>>> ______________________________________________________________
>>>> _________
>>>>> Notice:  This email message, together with any attachments,
>>>> may contain
>>>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>>>  affiliated
>>>>> entities,  that may be confidential,  proprietary,
>>>> copyrighted  and/or
>>>>> legally privileged, and is intended solely for the use of
>>>> the individual
>>>>> or entity named in this message. If you are not the
>>>> intended recipient,
>>>>> and have received this message in error, please immediately
>>>> return this
>>>>> by email and then delete it.
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Patrick Linskey [mailto:plinskey@bea.com]
>>>>>> Sent: Thursday, February 22, 2007 8:38 AM
>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>> Subject: RE: RE: Howto integrate JPA within EJB2.1 session
>>>>>> beans? [architecture]
>>>>>>
>>>>>>> If I understand it correct, I "just" have to bind the EMF
>>>>>>> onserver startup like.
>>>>>>>
>>>>>>> context.bind("my/jndi/name/for/emf",myEMFVariable);
>>>>>>
>>>>>> Yep.
>>>>>>
>>>>>>>         //does the statement below again create a NEW EMF
>>>>>> or ist this
>>>>>>>         //just a lookup in the jndi-tree? but why is it
>>>>>>> called "Create"
>>>>>>>         //and not get?
>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>             .createEntityManagerFactory(
>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>
>>>>>> It's just a lookup. I'm not sure why it's called
>> 'create'. Anyone?
>>>>>>
>>>>>>>         //why do I have to create a new
>>>>>> broker/entitymanager this way?
>>>>>>>         //is this because I have to "synchronize" the SLSBs
>>>>>>> transaction
>>>>>>>         //context with the newly created entitymanager?
>>>>>>
>>>>>> Yes -- our current OpenJPAPersistence EM lookup methods
>>>> all create new
>>>>>> EMs. The broker code will look up one associated with
>> the current
>>>>>> transaction, which is what you're looking for.
>>>>>>
>>>>>> Unfortunately, that means that we're using a synchronized
>>>> block during
>>>>>> the lookup. If it looks like EM lookup is a scalability
>>>> issue for your
>>>>>> app, do let us know -- it would be pretty straightforward to
>>>>>> replace the synchronized block with a concurrent map.
>>>>>>
>>>>>>> So if understand that right I just would have to call
>>>>>>>
>>>>>>> PersistenceService.getEntitymanager();
>>>>>>>
>>>>>>> in every SLSB method (NOT in ejbCreate) when needed? fine.
>>>>>>
>>>>>> Yep.
>>>>>>
>>>>>>> I really appreciate your help - it's quite complex
>> to integrate
>>>>>>> JPA into an existing Java2EE 1.4 AppServer
>> environment.. *puh*
>>>>>>
>>>>>> Yes -- sorry about that. We should at least be creating
>>>>>> better-designed helper methods in OpenJPA to help out with
>>>>>> this.
>>>>>>
>>>>>> One alternative, of course, is to use Spring 2, which does a
>>>>>> pretty good job of JPA bootstrapping.
>>>>>>
>>>>>> -Patrick
>>>>>>
>>>>>> --
>>>>>> Patrick Linskey
>>>>>> BEA Systems, Inc.
>>>>>>
>>>>>> ______________________________________________________________
>>>>>> _________
>>>>>> Notice:  This email message, together with any attachments,
>>>>>> may contain information  of  BEA Systems,  Inc.,  its
>>>>>> subsidiaries  and affiliated entities,  that may be
>>>>>> confidential,  proprietary, copyrighted  and/or legally
>>>>>> privileged, and is intended solely for the use of the
>>>>>> individual or entity named in this message. If you are not the
>>>>>> intended recipient, and have received this message in error,
>>>>>> please immediately return this by email and then delete it.
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Hans Prueller [mailto:hans.prueller@gmx.net]
>>>>>>> Sent: Thursday, February 22, 2007 4:36 AM
>>>>>>> To: open-jpa-dev@incubator.apache.org;
>>>>>>> open-jpa-dev@incubator.apache.org
>>>>>>> Subject: Re: RE: Howto integrate JPA within EJB2.1 session
>>>>>>> beans? [architecture]
>>>>>>>
>>>>>>> Patrick,
>>>>>>>
>>>>>>> thank you for that tip. To be true, I was not aware of
>>>>>>> lifecycle related problems between my SLSBs and JPA - thank
>>>>>>> you for that hint. As I want to avoid working with
>>>>>>> ThreadLocal (simply because I didn't work with ThreadLocals
>>>>>>> yet) I would prefer the JNDI-EMF based approach.
>>>>>>>
>>>>>>> If I understand it correct, I "just" have to bind the EMF
>>>>>>> onserver startup like.
>>>>>>>
>>>>>>> context.bind("my/jndi/name/for/emf",myEMFVariable);
>>>>>>>
>>>>>>> I would be interested what the code for the
>>>>>>> PersistenceService class does:
>>>>>>>
>>>>>>>
>>>>>>>         //does the statement below again create a NEW EMF
>>>>>> or ist this
>>>>>>>         //just a lookup in the jndi-tree? but why is it
>>>>>>> called "Create"
>>>>>>>         //and not get?
>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>             .createEntityManagerFactory(
>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>>
>>>>>>>         //why do i have to cast the EMF to a
>>>> brokerfactory now? I
>>>>>>>         //would guess the "broker" is something like a
>>>> more abstract
>>>>>>>         //concept of entitymanager(factory)?
>>>>>>>
>>>>>>>         //why do I have to create a new
>>>>>> broker/entitymanager this way?
>>>>>>>         //is this because I have to "synchronize" the SLSBs
>>>>>>> transaction
>>>>>>>         //context with the newly created entitymanager?
>>>>>>>
>>>>>>>         BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>>>>         Broker b = bf.newBroker(
>>>>>>>         bf.getConfiguration().getConnectionUserName(),
>>>>>>>           bf.getConfiguration().getConnectionPassword(),
>>>>>>>           true, // the broker is part of a JTA managed tx
>>>>>>>
>>>> bf.getConfiguration().getConnectionRetainModeConstant(),
>>>>>>>           true); // look for an existing Broker on the tx
>>>>>>>
>>>>>>>         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
>>>>>>>
>> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
>>>>>>>         broker.setDetachedNew(false);
>>>>>>>
>>>>>>>         return OpenJPAPersistence.toEntityManager(b);
>>>>>>>     }
>>>>>>>
>>>>>>> So if understand that right I just would have to call
>>>>>>>
>>>>>>> PersistenceService.getEntitymanager();
>>>>>>>
>>>>>>> in every SLSB method (NOT in ejbCreate) when needed? fine. I
>>>>>>> really appreciate your help - it's quite complex to
>> integrate
>>>>>>> JPA into an existing Java2EE 1.4 AppServer
>> environment.. *puh*
>>>>>>>
>>>>>>> regards
>>>>>>> Hans
>>>>>>>
>>>>>>> -------- Original-Nachricht --------
>>>>>>> Datum: Wed, 21 Feb 2007 08:43:20 -0800
>>>>>>> Von: "Patrick Linskey" <pl...@bea.com>
>>>>>>> An: open-jpa-dev@incubator.apache.org
>>>>>>> CC:
>>>>>>> Betreff: RE: Howto integrate JPA within EJB2.1
>> session beans?
>>>>>>> [architecture]
>>>>>>>
>>>>>>>> Another common technique is to get an EMF into
>> JNDI, either
>>>>>>> by using a
>>>>>>>> startup hook or deploying OpenJPA as a JCA RAR.
>>>>>>>>
>>>>>>>> Are you looking to integrate OpenJPA with your
>> current managed
>>>>>>>> transaction? If so, I'd be careful about creating an EM in
>>>>>>> ejbCreate(),
>>>>>>>> as its lifecycle is related to the life of the SLSB,
>>>> not to the
>>>>>>>> transactional context (the SLSB might be pooled). So, I'd
>>>>>>> just try to
>>>>>>>> get the EMF into JNDI when the server starts
>> (creating EMFs
>>>>>>> is slow).
>>>>>>>> Then, you could avoid having to use your own ThreadLocal
>>>>>>> work by using
>>>>>>>> the internal OpenJPA BrokerFactory APIs:
>>>>>>>>
>>>>>>>> public class PersistenceService {
>>>>>>>>     public static EntityManager getEntityManager() {
>>>>>>>>         EntityManagerFactory emf = OpenJPAPersistence
>>>>>>>>             .createEntityManagerFactory(
>>>>>>>>                 "your/EMF/JNDI/location", (Context) null);
>>>>>>>>         BrokerFactory bf = OpenJPAPersistence.cast(emf);
>>>>>>>>         Broker b = bf.newBroker(
>>>>>>>>             bf.getConfiguration().getConnectionUserName(),
>>>>>>>>             bf.getConfiguration().getConnectionPassword(),
>>>>>>>>             true, // the broker is part of a JTA
>> managed tx
>>>>>>>>
>>>>>> bf.getConfiguration().getConnectionRetainModeConstant(),
>>>>>>>>             true); // look for an existing Broker
>> on the tx
>>>>>>>>
>>>>>>>>         // do some JPA configuration setup. Logic
>> stolen from
>>>>>>>>         // EntityManagerFactoryImpl.
>>>>>>>>
>> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
>>>>>>>>
>>>> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
>>>>>>>>         broker.setDetachedNew(false);
>>>>>>>>
>>>>>>>>         return OpenJPAPersistence.toEntityManager(b);
>>>>>>>>     }
>>>>>>>> }
>>>>>>>>
>>>>>>>> Meanwhile, we really should add a couple new
>>>> OpenJPAPersistence /
>>>>>>>> OpenJPAEntityManagerFactory methods to help out with
>>>> this type of
>>>>>>>> bootstrapping.
>>>>>>>>
>>>>>>>> -Patrick
>>>>>>>>
>>>>>>>> --
>>>>>>>> Patrick Linskey
>>>>>>>> BEA Systems, Inc.
>>>>>>>>
>>>>>>>>
>>>>>>>
>> ______________________________________________________________
>>>>>>> _________
>>>>>>>> Notice:  This email message, together with any
>> attachments,
>>>>>>> may contain
>>>>>>>> information  of  BEA Systems,  Inc.,  its
>> subsidiaries  and
>>>>>>>  affiliated
>>>>>>>> entities,  that may be confidential,  proprietary,
>>>>>>> copyrighted  and/or
>>>>>>>> legally privileged, and is intended solely for the use of
>>>>>>> the individual
>>>>>>>> or entity named in this message. If you are not the
>>>>>>> intended recipient,
>>>>>>>> and have received this message in error, please
>> immediately
>>>>>>> return this
>>>>>>>> by email and then delete it.
>>>>>>>>
>>>>>>>>> -----Original Message-----
>>>>>>>>> From: Hans Prueller [mailto:hans.prueller@gmx.net]
>>>>>>>>> Sent: Wednesday, February 21, 2007 1:02 AM
>>>>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>>>>> Subject: Howto integrate JPA within EJB2.1
>> session beans?
>>>>>>>>> [architecture]
>>>>>>>>>
>>>>>>>>> Hi together,
>>>>>>>>>
>>>>>>>>> I'm sorry for bothering you with numerous basic
>> questions
>>>>>>>>> regarding OpenJPA and its usage but I have to migrate
>>>>>>>>> existing CMP EJBs to migrate within short time
>> to OpenJPA as
>>>>>>>>> we're having stability issues with the current
>> CMP engine.
>>>>>>>>>
>>>>>>>>> One last question I'd like to ask is regarding the
>>>>>>>>> recommended architecture of using OpenJPA within EJB2.1
>>>>>>>>> Stateless sessino beans:
>>>>>>>>>
>>>>>>>>> I need to work with persistence i.e. the EntityManager
>>>>>>>>> throughout all the session beans methods so my
>> idea is to:
>>>>>>>>>
>>>>>>>>> - create a EntityManagerFactory in the
>> ejbCreate() method
>>>>>>> of the SLSB
>>>>>>>>> - and also create the EntityManager itself in the
>>>>>>>>> ejbCreeate() method and store it as a member variable
>>>>>> of the SLSB
>>>>>>>>> - this would allow easy access within the SB's
>> methods by
>>>>>>>>> just using the already initialized entity
>> manager varialbe
>>>>>>>>> em.createNamedQuery() .. etc. etc.
>>>>>>>>> - clean up should be performed in the ejbRemove() method
>>>>>>> of the SLSB
>>>>>>>>>
>>>>>>>>> I think doing so will allow migratino to
>> openJPA with less
>>>>>>>>> work than doing the whole lookup procedure in
>> every method
>>>>>>>>> separately.
>>>>>>>>>
>>>>>>>>> what do you think? are there any pitfalls i've
>> overlooked?
>>>>>>>>>
>>>>>>>>> thank you for your ideas!
>>>>>>>>>
>>>>>>>>> regards
>>>>>>>>> Hans
>>>>>>>>> --
>>>>>>>>> "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
>>>>>>>>> Jetzt GMX ProMail testen:
>>>>>> www.gmx.net/de/go/mailfooter/promail-out
>>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
>>>>>>> Jetzt GMX ProMail testen:
>>>> www.gmx.net/de/go/mailfooter/promail-out
>>>>>>>
>>>>>>
>>>>
>>>>
>>
>>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


AW: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by "Hans J. Prueller" <ha...@gmx.net>.
>> -The name used for the lookup is defined to return an instance of the 
>> object that might be shared. The name java:comp/ORB is such a name.

does this mean that the name/key with which the EMF is bound into JNDI
affects the sharing/non-sharing of the bound instance?

currently the JNDI-string our test-implementation definitely does not
comply to any conventions (it's not like "java:comp/.." it's rather some
tests string like "here/comes/thejndi/name") - could that be the problem in
our case?

I'm not sure if I followed the whole discussion completely ... It seems
that you might have found another reason for the behaviour? Is this clear
already or is it still required to send more detailed stuff from our side?

regards,
hans

> -----Ursprüngliche Nachricht-----
> Von: Pinaki Poddar [mailto:ppoddar@bea.com]
> Gesendet: Dienstag, 27. Februar 2007 18:48
> An: open-jpa-dev@incubator.apache.org
> Betreff: RE: EMF JNDI lookup is starting openJPA every time - was: Howto
> integrate JPA within EJB2.1 session beans?
> 
>  > But maybe something funky is happening with JNDI serializing the
> factory and then deserializing it or something.
> 
> >From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and Directory
> Interface:
> 
> In general, lookups of objects in the JNDI java: namespace are required to
> return a new instance of the requested object every time. Exceptions are
> allowed for the following:
> - The container knows the object is immutable (for example, objects of
> type java.lang.String), or knows that the application can't change the
> state of
> the object.
> -The object is defined to be a singleton, such that only one instance of
> the object may exist in the JVM.
> -The name used for the lookup is defined to return an instance of the
> object that might be shared. The name java:comp/ORB is such a name.
> 
> In these cases, a shared instance of the object may be returned. In all
> other cases, a new instance of the requested object must be returned on
> each
> lookup.
> 
> 
> Pinaki Poddar
> BEA Systems
> 415.402.7317
> 
> 
> -----Original Message-----
> From: Patrick Linskey [mailto:plinskey@bea.com]
> Sent: Monday, February 26, 2007 11:11 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: EMF JNDI lookup is starting openJPA every time - was: Howto
> integrate JPA within EJB2.1 session beans?
> 
> It should be going through the following code:
> 
>     public static OpenJPAEntityManagerFactory createEntityManagerFactory
>         (String jndiLocation, Context context) {
>         if (jndiLocation == null)
>             throw new NullPointerException("jndiLocation == null");
> 
>         try {
>             if (context == null)
>                 context = new InitialContext();
> 
>             Object o = context.lookup(jndiLocation);
>             return (OpenJPAEntityManagerFactory)
> PortableRemoteObject.narrow(o,
>                 OpenJPAEntityManagerFactory.class);
>         } catch (NamingException ne) {
>             throw new ArgumentException(_loc.get("naming-exception",
>                 jndiLocation), new Throwable[]{ ne }, null, true);
>         }
>     }
> 
> I don't see anything in there that would be causing a creation to happen.
> But maybe something funky is happening with JNDI serializing the factory
> and then deserializing it or something.
> 
> Do you have any means of getting a stack from where the creation is
> happening? It'd be great to get a bit more context about what's going on.
> 
> -Patrick
> 
> --
> Patrick Linskey
> BEA Systems, Inc.
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this by
> email and then delete it.
> 
> > -----Original Message-----
> > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > Sent: Saturday, February 24, 2007 10:36 PM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: EMF JNDI lookup is starting openJPA every time -
> > was: Howto integrate JPA within EJB2.1 session beans?
> >
> > Hi together, Patrick,
> >
> > the code you suggested for doing a helper method that deals with the
> > EMF JNDI lookup and the EM creating within our J2EE1.4 app basically
> > works fine, but as you perhaps may remember I asked why the method is
> > called "create":
> >
> > EntityManagerFactory myemf =
> > OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> > (Context)null);
> >
> > It seems that the method above really creates a NEW EMF on every
> > invocation!
> > I checked the logs of my application and I see the following messages
> > on every invocation of my PersistenceService.getEntityManger()
> > method (which
> > does the above lookup and some more ..)
> >
> > 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
> > : creating a
> > fresh
> > , clean EntityManager from JNDI EMF.
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > openjpa.Runtime -
> > Starti
> > ng OpenJPA 0.9.7-incubating-SNAPSHOT
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > openjpa.jdbc.JDBC -
> > Open
> > JPA will now connect to the database to attempt to determine what type
> > of databa se dictionary to use.  To prevent this connection in the
> > future, set your openjp a.jdbc.DBDictionary configuration property to
> > the appropriate value for your dat abase (see the documentation for
> > available values).
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > openjpa.jdbc.JDBC -
> > Usin
> > g dictionary class
> > "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c
> > ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
> > 2006-10-19
> >  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5]
> > openjpa.MetaData -
> > Found
> >  1 classes with metadata in 0 milliseconds.
> >
> >
> > It seems that OpenJPA is now bootstrapping everytime I access it. I am
> > binding the EMF somewhen at bootstrapping time with
> >
> > final EntityManagerFactory emFactory = Persistence
> > 				.createEntityManagerFactory("lbsims");
> >
> > Context ictx = new InitialContext();
> > ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> >
> > The lookup uses the same constants, so the EMF in JNDI should be
> > found?
> >
> > EntityManagerFactory emf = OpenJPAPersistence
> >
> > .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> >
> > Any Idea what could be wrong here?
> >
> > regards,
> > HANS
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > Gesendet: Freitag, 23. Februar 2007 18:46
> > > An: open-jpa-dev@incubator.apache.org
> > > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
> > > [architecture]
> > >
> > > Typo indeed. It should be
> > OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > > about that.
> > >
> > > -Patrick
> > >
> > > --
> > > Patrick Linskey
> > > BEA Systems, Inc.
> > >
> > >
> > ______________________________________________________________
> > _________
> > > Notice:  This email message, together with any attachments,
> > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >  affiliated
> > > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of
> > the individual
> > > or entity named in this message. If you are not the
> > intended recipient,
> > > and have received this message in error, please immediately
> > return this
> > > by email and then delete it.
> > >
> > > > -----Original Message-----
> > > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > > Sent: Friday, February 23, 2007 9:43 AM
> > > > To: open-jpa-dev@incubator.apache.org
> > > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > > > beans? [architecture]
> > > >
> > > > Patrick,
> > > >
> > > > I'm currently trying your tip with a PersistenceService util class
> > > > doing the lookup of a synchronized entity manager. The problem is
> > > > that your sample code does not work!
> > > >
> > > > in fact the statement
> > > >
> > > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > >
> > > > is the problem. the above "cast" does not return a BrokerFactory
> > > > instance!
> > > >
> > > > I am using a 2 days old nightly snapshot 0.9.7 build
> > > >
> > > > Where is the problem?
> > > >
> > > > Hans
> > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > > An: open-jpa-dev@incubator.apache.org
> > > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1
> > session beans?
> > > > > [architecture]
> > > > >
> > > > > > Unfortunately, that means that we're using a synchronized
> > > > > > block during the lookup. If it looks like EM lookup is a
> > > > > > scalability issue for your app, do let us know -- it would be
> > > > > > pretty straightforward to replace the synchronized block with
> > > > > > a concurrent map.
> > > > >
> > > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > > tracks the
> > > > > issue; I've got a patch that I'll submit once some more
> > > > eyes look at it.
> > > > >
> > > > > -Patrick
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > BEA Systems, Inc.
> > > > >
> > > > >
> > > > ______________________________________________________________
> > > > _________
> > > > > Notice:  This email message, together with any attachments,
> > > > may contain
> > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > >  affiliated
> > > > > entities,  that may be confidential,  proprietary,
> > > > copyrighted  and/or
> > > > > legally privileged, and is intended solely for the use of
> > > > the individual
> > > > > or entity named in this message. If you are not the
> > > > intended recipient,
> > > > > and have received this message in error, please immediately
> > > > return this
> > > > > by email and then delete it.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > > > beans? [architecture]
> > > > > >
> > > > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > > > onserver startup like.
> > > > > > >
> > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > >
> > > > > > Yep.
> > > > > >
> > > > > > >         //does the statement below again create a NEW EMF
> > > > > > or ist this
> > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > called "Create"
> > > > > > >         //and not get?
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > >
> > > > > > It's just a lookup. I'm not sure why it's called
> > 'create'. Anyone?
> > > > > >
> > > > > > >         //why do I have to create a new
> > > > > > broker/entitymanager this way?
> > > > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > > > transaction
> > > > > > >         //context with the newly created entitymanager?
> > > > > >
> > > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > > all create new
> > > > > > EMs. The broker code will look up one associated with
> > the current
> > > > > > transaction, which is what you're looking for.
> > > > > >
> > > > > > Unfortunately, that means that we're using a synchronized
> > > > block during
> > > > > > the lookup. If it looks like EM lookup is a scalability
> > > > issue for your
> > > > > > app, do let us know -- it would be pretty straightforward to
> > > > > > replace the synchronized block with a concurrent map.
> > > > > >
> > > > > > > So if understand that right I just would have to call
> > > > > > >
> > > > > > > PersistenceService.getEntitymanager();
> > > > > > >
> > > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > > > > >
> > > > > > Yep.
> > > > > >
> > > > > > > I really appreciate your help - it's quite complex
> > to integrate
> > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > environment.. *puh*
> > > > > >
> > > > > > Yes -- sorry about that. We should at least be creating
> > > > > > better-designed helper methods in OpenJPA to help out with
> > > > > > this.
> > > > > >
> > > > > > One alternative, of course, is to use Spring 2, which does a
> > > > > > pretty good job of JPA bootstrapping.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > BEA Systems, Inc.
> > > > > >
> > > > > > ______________________________________________________________
> > > > > > _________
> > > > > > Notice:  This email message, together with any attachments,
> > > > > > may contain information  of  BEA Systems,  Inc.,  its
> > > > > > subsidiaries  and affiliated entities,  that may be
> > > > > > confidential,  proprietary, copyrighted  and/or legally
> > > > > > privileged, and is intended solely for the use of the
> > > > > > individual or entity named in this message. If you are not the
> > > > > > intended recipient, and have received this message in error,
> > > > > > please immediately return this by email and then delete it.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > > open-jpa-dev@incubator.apache.org
> > > > > > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session
> > > > > > > beans? [architecture]
> > > > > > >
> > > > > > > Patrick,
> > > > > > >
> > > > > > > thank you for that tip. To be true, I was not aware of
> > > > > > > lifecycle related problems between my SLSBs and JPA - thank
> > > > > > > you for that hint. As I want to avoid working with
> > > > > > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > > >
> > > > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > > > onserver startup like.
> > > > > > >
> > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > >
> > > > > > > I would be interested what the code for the
> > > > > > > PersistenceService class does:
> > > > > > >
> > > > > > >
> > > > > > >         //does the statement below again create a NEW EMF
> > > > > > or ist this
> > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > called "Create"
> > > > > > >         //and not get?
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > > >
> > > > > > >         //why do i have to cast the EMF to a
> > > > brokerfactory now? I
> > > > > > >         //would guess the "broker" is something like a
> > > > more abstract
> > > > > > >         //concept of entitymanager(factory)?
> > > > > > >
> > > > > > >         //why do I have to create a new
> > > > > > broker/entitymanager this way?
> > > > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > > > transaction
> > > > > > >         //context with the newly created entitymanager?
> > > > > > >
> > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > >         Broker b = bf.newBroker(
> > > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > > >           true, // the broker is part of a JTA managed tx
> > > > > > >
> > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > >           true); // look for an existing Broker on the tx
> > > > > > >
> > > > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > >
> > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > >         broker.setDetachedNew(false);
> > > > > > >
> > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > >     }
> > > > > > >
> > > > > > > So if understand that right I just would have to call
> > > > > > >
> > > > > > > PersistenceService.getEntitymanager();
> > > > > > >
> > > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine. I
> > > > > > > really appreciate your help - it's quite complex to
> > integrate
> > > > > > > JPA into an existing Java2EE 1.4 AppServer
> > environment.. *puh*
> > > > > > >
> > > > > > > regards
> > > > > > > Hans
> > > > > > >
> > > > > > > -------- Original-Nachricht --------
> > > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > > CC:
> > > > > > > Betreff: RE: Howto integrate JPA within EJB2.1
> > session beans?
> > > > > > > [architecture]
> > > > > > >
> > > > > > > > Another common technique is to get an EMF into
> > JNDI, either
> > > > > > > by using a
> > > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > > >
> > > > > > > > Are you looking to integrate OpenJPA with your
> > current managed
> > > > > > > > transaction? If so, I'd be careful about creating an EM in
> > > > > > > ejbCreate(),
> > > > > > > > as its lifecycle is related to the life of the SLSB,
> > > > not to the
> > > > > > > > transactional context (the SLSB might be pooled). So, I'd
> > > > > > > just try to
> > > > > > > > get the EMF into JNDI when the server starts
> > (creating EMFs
> > > > > > > is slow).
> > > > > > > > Then, you could avoid having to use your own ThreadLocal
> > > > > > > work by using
> > > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > > >
> > > > > > > > public class PersistenceService {
> > > > > > > >     public static EntityManager getEntityManager() {
> > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > >             .createEntityManagerFactory(
> > > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > > >         Broker b = bf.newBroker(
> > > > > > > >             bf.getConfiguration().getConnectionUserName(),
> > > > > > > >             bf.getConfiguration().getConnectionPassword(),
> > > > > > > >             true, // the broker is part of a JTA
> > managed tx
> > > > > > > >
> > > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > >             true); // look for an existing Broker
> > on the tx
> > > > > > > >
> > > > > > > >         // do some JPA configuration setup. Logic
> > stolen from
> > > > > > > >         // EntityManagerFactoryImpl.
> > > > > > > >
> > broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > >
> > > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > >         broker.setDetachedNew(false);
> > > > > > > >
> > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > >     }
> > > > > > > > }
> > > > > > > >
> > > > > > > > Meanwhile, we really should add a couple new
> > > > OpenJPAPersistence /
> > > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > > this type of
> > > > > > > > bootstrapping.
> > > > > > > >
> > > > > > > > -Patrick
> > > > > > > >
> > > > > > > > --
> > > > > > > > Patrick Linskey
> > > > > > > > BEA Systems, Inc.
> > > > > > > >
> > > > > > > >
> > > > > > >
> > ______________________________________________________________
> > > > > > > _________
> > > > > > > > Notice:  This email message, together with any
> > attachments,
> > > > > > > may contain
> > > > > > > > information  of  BEA Systems,  Inc.,  its
> > subsidiaries  and
> > > > > > >  affiliated
> > > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > > copyrighted  and/or
> > > > > > > > legally privileged, and is intended solely for the use of
> > > > > > > the individual
> > > > > > > > or entity named in this message. If you are not the
> > > > > > > intended recipient,
> > > > > > > > and have received this message in error, please
> > immediately
> > > > > > > return this
> > > > > > > > by email and then delete it.
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > > Subject: Howto integrate JPA within EJB2.1
> > session beans?
> > > > > > > > > [architecture]
> > > > > > > > >
> > > > > > > > > Hi together,
> > > > > > > > >
> > > > > > > > > I'm sorry for bothering you with numerous basic
> > questions
> > > > > > > > > regarding OpenJPA and its usage but I have to migrate
> > > > > > > > > existing CMP EJBs to migrate within short time
> > to OpenJPA as
> > > > > > > > > we're having stability issues with the current
> > CMP engine.
> > > > > > > > >
> > > > > > > > > One last question I'd like to ask is regarding the
> > > > > > > > > recommended architecture of using OpenJPA within EJB2.1
> > > > > > > > > Stateless sessino beans:
> > > > > > > > >
> > > > > > > > > I need to work with persistence i.e. the EntityManager
> > > > > > > > > throughout all the session beans methods so my
> > idea is to:
> > > > > > > > >
> > > > > > > > > - create a EntityManagerFactory in the
> > ejbCreate() method
> > > > > > > of the SLSB
> > > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > > ejbCreeate() method and store it as a member variable
> > > > > > of the SLSB
> > > > > > > > > - this would allow easy access within the SB's
> > methods by
> > > > > > > > > just using the already initialized entity
> > manager varialbe
> > > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > > - clean up should be performed in the ejbRemove() method
> > > > > > > of the SLSB
> > > > > > > > >
> > > > > > > > > I think doing so will allow migratino to
> > openJPA with less
> > > > > > > > > work than doing the whole lookup procedure in
> > every method
> > > > > > > > > separately.
> > > > > > > > >
> > > > > > > > > what do you think? are there any pitfalls i've
> > overlooked?
> > > > > > > > >
> > > > > > > > > thank you for your ideas!
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > > Hans
> > > > > > > > > --
> > > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > > Jetzt GMX ProMail testen:
> > > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > Jetzt GMX ProMail testen:
> > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > >
> > > > > >
> > > >
> > > >
> >
> >


RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Pinaki Poddar <pp...@bea.com>.
 > But maybe something funky is happening with JNDI serializing the factory and then deserializing it or something.

>From  J2EE 1.4 spec, page 59 (J2EE.5.2 Java Naming and Directory Interface:

In general, lookups of objects in the JNDI java: namespace are required to return a new instance of the requested object every time. Exceptions are 
allowed for the following:
- The container knows the object is immutable (for example, objects of type java.lang.String), or knows that the application can't change the state of 
the object.
-The object is defined to be a singleton, such that only one instance of the object may exist in the JVM.
-The name used for the lookup is defined to return an instance of the object that might be shared. The name java:comp/ORB is such a name.

In these cases, a shared instance of the object may be returned. In all other cases, a new instance of the requested object must be returned on each 
lookup.


Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Patrick Linskey [mailto:plinskey@bea.com] 
Sent: Monday, February 26, 2007 11:11 PM
To: open-jpa-dev@incubator.apache.org
Subject: RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans? 

It should be going through the following code:

    public static OpenJPAEntityManagerFactory createEntityManagerFactory
        (String jndiLocation, Context context) {
        if (jndiLocation == null)
            throw new NullPointerException("jndiLocation == null");

        try {
            if (context == null)
                context = new InitialContext();

            Object o = context.lookup(jndiLocation);
            return (OpenJPAEntityManagerFactory) PortableRemoteObject.narrow(o,
                OpenJPAEntityManagerFactory.class);
        } catch (NamingException ne) {
            throw new ArgumentException(_loc.get("naming-exception",
                jndiLocation), new Throwable[]{ ne }, null, true);
        }
    }

I don't see anything in there that would be causing a creation to happen. But maybe something funky is happening with JNDI serializing the factory and then deserializing it or something.

Do you have any means of getting a stack from where the creation is happening? It'd be great to get a bit more context about what's going on.

-Patrick

--
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. 

> -----Original Message-----
> From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> Sent: Saturday, February 24, 2007 10:36 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: EMF JNDI lookup is starting openJPA every time -
> was: Howto integrate JPA within EJB2.1 session beans? 
> 
> Hi together, Patrick,
> 
> the code you suggested for doing a helper method that deals with the 
> EMF JNDI lookup and the EM creating within our J2EE1.4 app basically 
> works fine, but as you perhaps may remember I asked why the method is 
> called "create":
> 
> EntityManagerFactory myemf =
> OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> (Context)null);
> 
> It seems that the method above really creates a NEW EMF on every 
> invocation!
> I checked the logs of my application and I see the following messages 
> on every invocation of my PersistenceService.getEntityManger()
> method (which
> does the above lookup and some more ..)
> 
> 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager
> : creating a
> fresh
> , clean EntityManager from JNDI EMF.
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.Runtime -
> Starti
> ng OpenJPA 0.9.7-incubating-SNAPSHOT
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.jdbc.JDBC -
> Open
> JPA will now connect to the database to attempt to determine what type 
> of databa se dictionary to use.  To prevent this connection in the 
> future, set your openjp a.jdbc.DBDictionary configuration property to 
> the appropriate value for your dat abase (see the documentation for 
> available values).
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.jdbc.JDBC -
> Usin
> g dictionary class
> "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.0.27-c 
> ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
> 2006-10-19
>  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.MetaData -
> Found
>  1 classes with metadata in 0 milliseconds.
> 
> 
> It seems that OpenJPA is now bootstrapping everytime I access it. I am 
> binding the EMF somewhen at bootstrapping time with
> 
> final EntityManagerFactory emFactory = Persistence
> 				.createEntityManagerFactory("lbsims");
> 
> Context ictx = new InitialContext();
> ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> 
> The lookup uses the same constants, so the EMF in JNDI should be 
> found?
> 
> EntityManagerFactory emf = OpenJPAPersistence
> 	
> .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> 
> Any Idea what could be wrong here?
> 
> regards,
> HANS
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > Gesendet: Freitag, 23. Februar 2007 18:46
> > An: open-jpa-dev@incubator.apache.org
> > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
> > [architecture]
> > 
> > Typo indeed. It should be
> OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > about that.
> > 
> > -Patrick
> > 
> > --
> > Patrick Linskey
> > BEA Systems, Inc.
> > 
> > 
> ______________________________________________________________
> _________
> > Notice:  This email message, together with any attachments,
> may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and
>  affiliated
> > entities,  that may be confidential,  proprietary,
> copyrighted  and/or
> > legally privileged, and is intended solely for the use of
> the individual
> > or entity named in this message. If you are not the
> intended recipient,
> > and have received this message in error, please immediately
> return this
> > by email and then delete it.
> > 
> > > -----Original Message-----
> > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > Sent: Friday, February 23, 2007 9:43 AM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session 
> > > beans? [architecture]
> > >
> > > Patrick,
> > >
> > > I'm currently trying your tip with a PersistenceService util class 
> > > doing the lookup of a synchronized entity manager. The problem is 
> > > that your sample code does not work!
> > >
> > > in fact the statement
> > >
> > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > >
> > > is the problem. the above "cast" does not return a BrokerFactory 
> > > instance!
> > >
> > > I am using a 2 days old nightly snapshot 0.9.7 build
> > >
> > > Where is the problem?
> > >
> > > Hans
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > An: open-jpa-dev@incubator.apache.org
> > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1
> session beans?
> > > > [architecture]
> > > >
> > > > > Unfortunately, that means that we're using a synchronized 
> > > > > block during the lookup. If it looks like EM lookup is a 
> > > > > scalability issue for your app, do let us know -- it would be 
> > > > > pretty straightforward to replace the synchronized block with 
> > > > > a concurrent map.
> > > >
> > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > tracks the
> > > > issue; I've got a patch that I'll submit once some more
> > > eyes look at it.
> > > >
> > > > -Patrick
> > > >
> > > > --
> > > > Patrick Linskey
> > > > BEA Systems, Inc.
> > > >
> > > >
> > > ______________________________________________________________
> > > _________
> > > > Notice:  This email message, together with any attachments,
> > > may contain
> > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > >  affiliated
> > > > entities,  that may be confidential,  proprietary,
> > > copyrighted  and/or
> > > > legally privileged, and is intended solely for the use of
> > > the individual
> > > > or entity named in this message. If you are not the
> > > intended recipient,
> > > > and have received this message in error, please immediately
> > > return this
> > > > by email and then delete it.
> > > >
> > > > > -----Original Message-----
> > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > To: open-jpa-dev@incubator.apache.org
> > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session 
> > > > > beans? [architecture]
> > > > >
> > > > > > If I understand it correct, I "just" have to bind the EMF 
> > > > > > onserver startup like.
> > > > > >
> > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > >
> > > > > Yep.
> > > > >
> > > > > >         //does the statement below again create a NEW EMF
> > > > > or ist this
> > > > > >         //just a lookup in the jndi-tree? but why is it 
> > > > > > called "Create"
> > > > > >         //and not get?
> > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > >             .createEntityManagerFactory(
> > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > >
> > > > > It's just a lookup. I'm not sure why it's called
> 'create'. Anyone?
> > > > >
> > > > > >         //why do I have to create a new
> > > > > broker/entitymanager this way?
> > > > > >         //is this because I have to "synchronize" the SLSBs 
> > > > > > transaction
> > > > > >         //context with the newly created entitymanager?
> > > > >
> > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > all create new
> > > > > EMs. The broker code will look up one associated with
> the current
> > > > > transaction, which is what you're looking for.
> > > > >
> > > > > Unfortunately, that means that we're using a synchronized
> > > block during
> > > > > the lookup. If it looks like EM lookup is a scalability
> > > issue for your
> > > > > app, do let us know -- it would be pretty straightforward to 
> > > > > replace the synchronized block with a concurrent map.
> > > > >
> > > > > > So if understand that right I just would have to call
> > > > > >
> > > > > > PersistenceService.getEntitymanager();
> > > > > >
> > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > > > >
> > > > > Yep.
> > > > >
> > > > > > I really appreciate your help - it's quite complex
> to integrate
> > > > > > JPA into an existing Java2EE 1.4 AppServer
> environment.. *puh*
> > > > >
> > > > > Yes -- sorry about that. We should at least be creating 
> > > > > better-designed helper methods in OpenJPA to help out with 
> > > > > this.
> > > > >
> > > > > One alternative, of course, is to use Spring 2, which does a 
> > > > > pretty good job of JPA bootstrapping.
> > > > >
> > > > > -Patrick
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > BEA Systems, Inc.
> > > > >
> > > > > ______________________________________________________________
> > > > > _________
> > > > > Notice:  This email message, together with any attachments, 
> > > > > may contain information  of  BEA Systems,  Inc.,  its 
> > > > > subsidiaries  and affiliated entities,  that may be 
> > > > > confidential,  proprietary, copyrighted  and/or legally 
> > > > > privileged, and is intended solely for the use of the 
> > > > > individual or entity named in this message. If you are not the 
> > > > > intended recipient, and have received this message in error, 
> > > > > please immediately return this by email and then delete it.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > open-jpa-dev@incubator.apache.org
> > > > > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session 
> > > > > > beans? [architecture]
> > > > > >
> > > > > > Patrick,
> > > > > >
> > > > > > thank you for that tip. To be true, I was not aware of 
> > > > > > lifecycle related problems between my SLSBs and JPA - thank 
> > > > > > you for that hint. As I want to avoid working with 
> > > > > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > >
> > > > > > If I understand it correct, I "just" have to bind the EMF 
> > > > > > onserver startup like.
> > > > > >
> > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > >
> > > > > > I would be interested what the code for the 
> > > > > > PersistenceService class does:
> > > > > >
> > > > > >
> > > > > >         //does the statement below again create a NEW EMF
> > > > > or ist this
> > > > > >         //just a lookup in the jndi-tree? but why is it 
> > > > > > called "Create"
> > > > > >         //and not get?
> > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > >             .createEntityManagerFactory(
> > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > >
> > > > > >         //why do i have to cast the EMF to a
> > > brokerfactory now? I
> > > > > >         //would guess the "broker" is something like a
> > > more abstract
> > > > > >         //concept of entitymanager(factory)?
> > > > > >
> > > > > >         //why do I have to create a new
> > > > > broker/entitymanager this way?
> > > > > >         //is this because I have to "synchronize" the SLSBs 
> > > > > > transaction
> > > > > >         //context with the newly created entitymanager?
> > > > > >
> > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > >         Broker b = bf.newBroker(
> > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > >           true, // the broker is part of a JTA managed tx
> > > > > >
> > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > >           true); // look for an existing Broker on the tx
> > > > > >
> > > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > >         broker.setDetachedNew(false);
> > > > > >
> > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > >     }
> > > > > >
> > > > > > So if understand that right I just would have to call
> > > > > >
> > > > > > PersistenceService.getEntitymanager();
> > > > > >
> > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine. I 
> > > > > > really appreciate your help - it's quite complex to
> integrate
> > > > > > JPA into an existing Java2EE 1.4 AppServer
> environment.. *puh*
> > > > > >
> > > > > > regards
> > > > > > Hans
> > > > > >
> > > > > > -------- Original-Nachricht --------
> > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > CC:
> > > > > > Betreff: RE: Howto integrate JPA within EJB2.1
> session beans?
> > > > > > [architecture]
> > > > > >
> > > > > > > Another common technique is to get an EMF into
> JNDI, either
> > > > > > by using a
> > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > >
> > > > > > > Are you looking to integrate OpenJPA with your
> current managed
> > > > > > > transaction? If so, I'd be careful about creating an EM in
> > > > > > ejbCreate(),
> > > > > > > as its lifecycle is related to the life of the SLSB,
> > > not to the
> > > > > > > transactional context (the SLSB might be pooled). So, I'd
> > > > > > just try to
> > > > > > > get the EMF into JNDI when the server starts
> (creating EMFs
> > > > > > is slow).
> > > > > > > Then, you could avoid having to use your own ThreadLocal
> > > > > > work by using
> > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > >
> > > > > > > public class PersistenceService {
> > > > > > >     public static EntityManager getEntityManager() {
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > >         Broker b = bf.newBroker(
> > > > > > >             bf.getConfiguration().getConnectionUserName(),
> > > > > > >             bf.getConfiguration().getConnectionPassword(),
> > > > > > >             true, // the broker is part of a JTA
> managed tx
> > > > > > >
> > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > >             true); // look for an existing Broker
> on the tx
> > > > > > >
> > > > > > >         // do some JPA configuration setup. Logic
> stolen from
> > > > > > >         // EntityManagerFactoryImpl.
> > > > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > >
> > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > >         broker.setDetachedNew(false);
> > > > > > >
> > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > >     }
> > > > > > > }
> > > > > > >
> > > > > > > Meanwhile, we really should add a couple new
> > > OpenJPAPersistence /
> > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > this type of
> > > > > > > bootstrapping.
> > > > > > >
> > > > > > > -Patrick
> > > > > > >
> > > > > > > --
> > > > > > > Patrick Linskey
> > > > > > > BEA Systems, Inc.
> > > > > > >
> > > > > > >
> > > > > > 
> ______________________________________________________________
> > > > > > _________
> > > > > > > Notice:  This email message, together with any
> attachments,
> > > > > > may contain
> > > > > > > information  of  BEA Systems,  Inc.,  its
> subsidiaries  and
> > > > > >  affiliated
> > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > copyrighted  and/or
> > > > > > > legally privileged, and is intended solely for the use of
> > > > > > the individual
> > > > > > > or entity named in this message. If you are not the
> > > > > > intended recipient,
> > > > > > > and have received this message in error, please
> immediately
> > > > > > return this
> > > > > > > by email and then delete it.
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > Subject: Howto integrate JPA within EJB2.1
> session beans?
> > > > > > > > [architecture]
> > > > > > > >
> > > > > > > > Hi together,
> > > > > > > >
> > > > > > > > I'm sorry for bothering you with numerous basic
> questions
> > > > > > > > regarding OpenJPA and its usage but I have to migrate 
> > > > > > > > existing CMP EJBs to migrate within short time
> to OpenJPA as
> > > > > > > > we're having stability issues with the current
> CMP engine.
> > > > > > > >
> > > > > > > > One last question I'd like to ask is regarding the 
> > > > > > > > recommended architecture of using OpenJPA within EJB2.1 
> > > > > > > > Stateless sessino beans:
> > > > > > > >
> > > > > > > > I need to work with persistence i.e. the EntityManager 
> > > > > > > > throughout all the session beans methods so my
> idea is to:
> > > > > > > >
> > > > > > > > - create a EntityManagerFactory in the
> ejbCreate() method
> > > > > > of the SLSB
> > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > ejbCreeate() method and store it as a member variable
> > > > > of the SLSB
> > > > > > > > - this would allow easy access within the SB's
> methods by
> > > > > > > > just using the already initialized entity
> manager varialbe
> > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > - clean up should be performed in the ejbRemove() method
> > > > > > of the SLSB
> > > > > > > >
> > > > > > > > I think doing so will allow migratino to
> openJPA with less
> > > > > > > > work than doing the whole lookup procedure in
> every method
> > > > > > > > separately.
> > > > > > > >
> > > > > > > > what do you think? are there any pitfalls i've
> overlooked?
> > > > > > > >
> > > > > > > > thank you for your ideas!
> > > > > > > >
> > > > > > > > regards
> > > > > > > > Hans
> > > > > > > > --
> > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > Jetzt GMX ProMail testen:
> > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > >
> > > > > >
> > > > > > --
> > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > Jetzt GMX ProMail testen:
> > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > >
> > > > >
> > >
> > >
> 
> 

RE: RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Patrick Linskey <pl...@bea.com>.
> Would it be helpful if I provide the output of 
> "Thread.dumpStack()" within
> the invocation of my PersistenceService.getEntityManager() method?

No -- that'll just provide info about your environment. But looking at your logs in more detail, I'm curious about what your PersistenceService method does. Could you post the full declaration of the method, and how you're invoking it?

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Hans Prueller [mailto:hans.prueller@gmx.net] 
> Sent: Tuesday, February 27, 2007 4:10 AM
> To: open-jpa-dev@incubator.apache.org; 
> open-jpa-dev@incubator.apache.org
> Subject: Re: RE: EMF JNDI lookup is starting openJPA every 
> time - was: Howto integrate JPA within EJB2.1 session beans?
> 
> strange. 
> 
> When I look on the code it seems that it definitely could NOT 
> be the case that the EMF is not correctly bound to the JNDI 
> tree as the method OpenJPAEntityManagerFactory 
> createEntityManagerFactory does no create for itself. 
> So somehow the EMF must be bound to the JNDI tree but 
> nevertheless I can see the init-logmessages evertime I access 
> it from JNDI...
> 
> I will try to provide more detailed information.
> 
> Would it be helpful if I provide the output of 
> "Thread.dumpStack()" within
> the invocation of my PersistenceService.getEntityManager() method?
> 
> regards,
> hans
> 
> 
> -------- Original-Nachricht --------
> Datum: Mon, 26 Feb 2007 23:10:42 -0800
> Von: "Patrick Linskey" <pl...@bea.com>
> An: open-jpa-dev@incubator.apache.org
> CC: 
> Betreff: RE: EMF JNDI lookup is starting openJPA every time - 
> was: Howto integrate JPA within EJB2.1 session beans?
> 
> > It should be going through the following code:
> > 
> >     public static OpenJPAEntityManagerFactory 
> createEntityManagerFactory
> >         (String jndiLocation, Context context) {
> >         if (jndiLocation == null)
> >             throw new NullPointerException("jndiLocation == null");
> > 
> >         try {
> >             if (context == null)
> >                 context = new InitialContext();
> > 
> >             Object o = context.lookup(jndiLocation);
> >             return (OpenJPAEntityManagerFactory)
> > PortableRemoteObject.narrow(o,
> >                 OpenJPAEntityManagerFactory.class);
> >         } catch (NamingException ne) {
> >             throw new ArgumentException(_loc.get("naming-exception",
> >                 jndiLocation), new Throwable[]{ ne }, null, true);
> >         }
> >     }
> > 
> > I don't see anything in there that would be causing a 
> creation to happen.
> > But maybe something funky is happening with JNDI 
> serializing the factory
> > and then deserializing it or something.
> > 
> > Do you have any means of getting a stack from where the creation is
> > happening? It'd be great to get a bit more context about 
> what's going on.
> > 
> > -Patrick
> > 
> > -- 
> > Patrick Linskey
> > BEA Systems, Inc. 
> > 
> > 
> ______________________________________________________________
> _________
> > Notice:  This email message, together with any attachments, 
> may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and 
>  affiliated
> > entities,  that may be confidential,  proprietary,  
> copyrighted  and/or
> > legally privileged, and is intended solely for the use of 
> the individual
> > or entity named in this message. If you are not the 
> intended recipient,
> > and have received this message in error, please immediately 
> return this
> > by email and then delete it. 
> > 
> > > -----Original Message-----
> > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> > > Sent: Saturday, February 24, 2007 10:36 PM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: EMF JNDI lookup is starting openJPA every time - 
> > > was: Howto integrate JPA within EJB2.1 session beans? 
> > > 
> > > Hi together, Patrick,
> > > 
> > > the code you suggested for doing a helper method that deals 
> > > with the EMF
> > > JNDI lookup and the EM creating within our J2EE1.4 app 
> > > basically works fine,
> > > but as you perhaps may remember I asked why the method is 
> > > called "create":
> > > 
> > > EntityManagerFactory myemf =
> > > OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> > > (Context)null);
> > > 
> > > It seems that the method above really creates a NEW EMF on 
> > > every invocation!
> > > I checked the logs of my application and I see the following 
> > > messages on
> > > every invocation of my PersistenceService.getEntityManger() 
> > > method (which
> > > does the above lookup and some more ..)
> > > 
> > > 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager 
> > > : creating a
> > > fresh
> > > , clean EntityManager from JNDI EMF.
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > > openjpa.Runtime -
> > > Starti
> > > ng OpenJPA 0.9.7-incubating-SNAPSHOT
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > > openjpa.jdbc.JDBC -
> > > Open
> > > JPA will now connect to the database to attempt to determine 
> > > what type of
> > > databa
> > > se dictionary to use.  To prevent this connection in the 
> > > future, set your
> > > openjp
> > > a.jdbc.DBDictionary configuration property to the appropriate 
> > > value for your
> > > dat
> > > abase (see the documentation for available values).
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > > openjpa.jdbc.JDBC -
> > > Usin
> > > g dictionary class 
> > > "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL
> > > 5.0.27-c
> > > ommunity-nt ,MySQL-AB JDBC Driver 
> mysql-connector-java-5.0.4 ( $Date:
> > > 2006-10-19
> > >  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> > > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > > openjpa.MetaData -
> > > Found
> > >  1 classes with metadata in 0 milliseconds.
> > > 
> > > 
> > > It seems that OpenJPA is now bootstrapping everytime I 
> access it. I am
> > > binding the EMF somewhen at bootstrapping time with
> > > 
> > > final EntityManagerFactory emFactory = Persistence
> > > 				.createEntityManagerFactory("lbsims");
> > > 
> > > Context ictx = new InitialContext();
> > > ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> > > 
> > > The lookup uses the same constants, so the EMF in JNDI should 
> > > be found?
> > > 
> > > EntityManagerFactory emf = OpenJPAPersistence
> > > 	
> > > .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> > > 
> > > Any Idea what could be wrong here?
> > > 
> > > regards,
> > > HANS
> > > 
> > > 
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > Gesendet: Freitag, 23. Februar 2007 18:46
> > > > An: open-jpa-dev@incubator.apache.org
> > > > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 
> session beans?
> > > > [architecture]
> > > > 
> > > > Typo indeed. It should be 
> > > OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > > > about that.
> > > > 
> > > > -Patrick
> > > > 
> > > > --
> > > > Patrick Linskey
> > > > BEA Systems, Inc.
> > > > 
> > > > 
> > > ______________________________________________________________
> > > _________
> > > > Notice:  This email message, together with any attachments, 
> > > may contain
> > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and 
> > >  affiliated
> > > > entities,  that may be confidential,  proprietary,  
> > > copyrighted  and/or
> > > > legally privileged, and is intended solely for the use of 
> > > the individual
> > > > or entity named in this message. If you are not the 
> > > intended recipient,
> > > > and have received this message in error, please immediately 
> > > return this
> > > > by email and then delete it.
> > > > 
> > > > > -----Original Message-----
> > > > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > > > Sent: Friday, February 23, 2007 9:43 AM
> > > > > To: open-jpa-dev@incubator.apache.org
> > > > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > > > > beans? [architecture]
> > > > >
> > > > > Patrick,
> > > > >
> > > > > I'm currently trying your tip with a PersistenceService util
> > > > > class doing
> > > > > the lookup of a synchronized entity manager. The problem is
> > > > > that your sample
> > > > > code does not work!
> > > > >
> > > > > in fact the statement
> > > > >
> > > > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > >
> > > > > is the problem. the above "cast" does not return a
> > > > > BrokerFactory instance!
> > > > >
> > > > > I am using a 2 days old nightly snapshot 0.9.7 build
> > > > >
> > > > > Where is the problem?
> > > > >
> > > > > Hans
> > > > >
> > > > > > -----Ursprüngliche Nachricht-----
> > > > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1 
> > > session beans?
> > > > > > [architecture]
> > > > > >
> > > > > > > Unfortunately, that means that we're using a synchronized
> > > > > > > block during the lookup. If it looks like EM lookup is a
> > > > > > > scalability issue for your app, do let us know -- it would
> > > > > > > be pretty straightforward to replace the 
> synchronized block
> > > > > > > with a concurrent map.
> > > > > >
> > > > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > > > tracks the
> > > > > > issue; I've got a patch that I'll submit once some more
> > > > > eyes look at it.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > BEA Systems, Inc.
> > > > > >
> > > > > >
> > > > > ______________________________________________________________
> > > > > _________
> > > > > > Notice:  This email message, together with any attachments,
> > > > > may contain
> > > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > >  affiliated
> > > > > > entities,  that may be confidential,  proprietary,
> > > > > copyrighted  and/or
> > > > > > legally privileged, and is intended solely for the use of
> > > > > the individual
> > > > > > or entity named in this message. If you are not the
> > > > > intended recipient,
> > > > > > and have received this message in error, please immediately
> > > > > return this
> > > > > > by email and then delete it.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > > > > beans? [architecture]
> > > > > > >
> > > > > > > > If I understand it correct, I "just" have to 
> bind the EMF
> > > > > > > > onserver startup like.
> > > > > > > >
> > > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > >
> > > > > > > Yep.
> > > > > > >
> > > > > > > >         //does the statement below again create 
> a NEW EMF
> > > > > > > or ist this
> > > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > > called "Create"
> > > > > > > >         //and not get?
> > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > >             .createEntityManagerFactory(
> > > > > > > >                 "your/EMF/JNDI/location", 
> (Context) null);
> > > > > > >
> > > > > > > It's just a lookup. I'm not sure why it's called 
> > > 'create'. Anyone?
> > > > > > >
> > > > > > > >         //why do I have to create a new
> > > > > > > broker/entitymanager this way?
> > > > > > > >         //is this because I have to 
> "synchronize" the SLSBs
> > > > > > > > transaction
> > > > > > > >         //context with the newly created entitymanager?
> > > > > > >
> > > > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > > > all create new
> > > > > > > EMs. The broker code will look up one associated with 
> > > the current
> > > > > > > transaction, which is what you're looking for.
> > > > > > >
> > > > > > > Unfortunately, that means that we're using a synchronized
> > > > > block during
> > > > > > > the lookup. If it looks like EM lookup is a scalability
> > > > > issue for your
> > > > > > > app, do let us know -- it would be pretty 
> straightforward to
> > > > > > > replace the
> > > > > > > synchronized block with a concurrent map.
> > > > > > >
> > > > > > > > So if understand that right I just would have to call
> > > > > > > >
> > > > > > > > PersistenceService.getEntitymanager();
> > > > > > > >
> > > > > > > > in every SLSB method (NOT in ejbCreate) when 
> needed? fine.
> > > > > > >
> > > > > > > Yep.
> > > > > > >
> > > > > > > > I really appreciate your help - it's quite complex 
> > > to integrate
> > > > > > > > JPA into an existing Java2EE 1.4 AppServer 
> > > environment.. *puh*
> > > > > > >
> > > > > > > Yes -- sorry about that. We should at least be creating
> > > > > > > better-designed
> > > > > > > helper methods in OpenJPA to help out with this.
> > > > > > >
> > > > > > > One alternative, of course, is to use Spring 2, 
> which does a
> > > > > > > pretty good
> > > > > > > job of JPA bootstrapping.
> > > > > > >
> > > > > > > -Patrick
> > > > > > >
> > > > > > > --
> > > > > > > Patrick Linskey
> > > > > > > BEA Systems, Inc.
> > > > > > >
> > > > > > > 
> ______________________________________________________________
> > > > > > > _________
> > > > > > > Notice:  This email message, together with any 
> attachments,
> > > > > > > may contain
> > > > > > > information  of  BEA Systems,  Inc.,  its 
> subsidiaries  and
> > > > > > > affiliated
> > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > > copyrighted  and/or
> > > > > > > legally privileged, and is intended solely for 
> the use of the
> > > > > > > individual
> > > > > > > or entity named in this message. If you are not 
> the intended
> > > > > > > recipient,
> > > > > > > and have received this message in error, please 
> immediately
> > > > > > > return this
> > > > > > > by email and then delete it.
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > > > open-jpa-dev@incubator.apache.org
> > > > > > > > Subject: Re: RE: Howto integrate JPA within 
> EJB2.1 session
> > > > > > > > beans? [architecture]
> > > > > > > >
> > > > > > > > Patrick,
> > > > > > > >
> > > > > > > > thank you for that tip. To be true, I was not aware of
> > > > > > > > lifecycle related problems between my SLSBs and 
> JPA - thank
> > > > > > > > you for that hint. As I want to avoid working with
> > > > > > > > ThreadLocal (simply because I didn't work with 
> ThreadLocals
> > > > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > > > >
> > > > > > > > If I understand it correct, I "just" have to 
> bind the EMF
> > > > > > > > onserver startup like.
> > > > > > > >
> > > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > > >
> > > > > > > > I would be interested what the code for the
> > > > > > > > PersistenceService class does:
> > > > > > > >
> > > > > > > >
> > > > > > > >         //does the statement below again create 
> a NEW EMF
> > > > > > > or ist this
> > > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > > called "Create"
> > > > > > > >         //and not get?
> > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > >             .createEntityManagerFactory(
> > > > > > > >                 "your/EMF/JNDI/location", 
> (Context) null);
> > > > > > > >
> > > > > > > >         //why do i have to cast the EMF to a
> > > > > brokerfactory now? I
> > > > > > > >         //would guess the "broker" is something like a
> > > > > more abstract
> > > > > > > >         //concept of entitymanager(factory)?
> > > > > > > >
> > > > > > > >         //why do I have to create a new
> > > > > > > broker/entitymanager this way?
> > > > > > > >         //is this because I have to 
> "synchronize" the SLSBs
> > > > > > > > transaction
> > > > > > > >         //context with the newly created entitymanager?
> > > > > > > >
> > > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > > >         Broker b = bf.newBroker(
> > > > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > > > >           true, // the broker is part of a JTA 
> managed tx
> > > > > > > >
> > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > >           true); // look for an existing Broker 
> on the tx
> > > > > > > >
> > > > > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > >         
> > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > >         broker.setDetachedNew(false);
> > > > > > > >
> > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > >     }
> > > > > > > >
> > > > > > > > So if understand that right I just would have to call
> > > > > > > >
> > > > > > > > PersistenceService.getEntitymanager();
> > > > > > > >
> > > > > > > > in every SLSB method (NOT in ejbCreate) when 
> needed? fine. I
> > > > > > > > really appreciate your help - it's quite complex to 
> > > integrate
> > > > > > > > JPA into an existing Java2EE 1.4 AppServer 
> > > environment.. *puh*
> > > > > > > >
> > > > > > > > regards
> > > > > > > > Hans
> > > > > > > >
> > > > > > > > -------- Original-Nachricht --------
> > > > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > > > CC:
> > > > > > > > Betreff: RE: Howto integrate JPA within EJB2.1 
> > > session beans?
> > > > > > > > [architecture]
> > > > > > > >
> > > > > > > > > Another common technique is to get an EMF into 
> > > JNDI, either
> > > > > > > > by using a
> > > > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > > > >
> > > > > > > > > Are you looking to integrate OpenJPA with your 
> > > current managed
> > > > > > > > > transaction? If so, I'd be careful about 
> creating an EM in
> > > > > > > > ejbCreate(),
> > > > > > > > > as its lifecycle is related to the life of the SLSB,
> > > > > not to the
> > > > > > > > > transactional context (the SLSB might be 
> pooled). So, I'd
> > > > > > > > just try to
> > > > > > > > > get the EMF into JNDI when the server starts 
> > > (creating EMFs
> > > > > > > > is slow).
> > > > > > > > > Then, you could avoid having to use your own 
> ThreadLocal
> > > > > > > > work by using
> > > > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > > > >
> > > > > > > > > public class PersistenceService {
> > > > > > > > >     public static EntityManager getEntityManager() {
> > > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > > >             .createEntityManagerFactory(
> > > > > > > > >                 "your/EMF/JNDI/location", 
> (Context) null);
> > > > > > > > >         BrokerFactory bf = 
> OpenJPAPersistence.cast(emf);
> > > > > > > > >         Broker b = bf.newBroker(
> > > > > > > > >             
> bf.getConfiguration().getConnectionUserName(),
> > > > > > > > >             
> bf.getConfiguration().getConnectionPassword(),
> > > > > > > > >             true, // the broker is part of a JTA 
> > > managed tx
> > > > > > > > >
> > > > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > > >             true); // look for an existing Broker 
> > > on the tx
> > > > > > > > >
> > > > > > > > >         // do some JPA configuration setup. Logic 
> > > stolen from
> > > > > > > > >         // EntityManagerFactoryImpl.
> > > > > > > > >         
> > > broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > > >
> > > > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > > >         broker.setDetachedNew(false);
> > > > > > > > >
> > > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > > >     }
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > Meanwhile, we really should add a couple new
> > > > > OpenJPAPersistence /
> > > > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > > > this type of
> > > > > > > > > bootstrapping.
> > > > > > > > >
> > > > > > > > > -Patrick
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Patrick Linskey
> > > > > > > > > BEA Systems, Inc.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > 
> > > ______________________________________________________________
> > > > > > > > _________
> > > > > > > > > Notice:  This email message, together with any 
> > > attachments,
> > > > > > > > may contain
> > > > > > > > > information  of  BEA Systems,  Inc.,  its 
> > > subsidiaries  and
> > > > > > > >  affiliated
> > > > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > > > copyrighted  and/or
> > > > > > > > > legally privileged, and is intended solely 
> for the use of
> > > > > > > > the individual
> > > > > > > > > or entity named in this message. If you are not the
> > > > > > > > intended recipient,
> > > > > > > > > and have received this message in error, please 
> > > immediately
> > > > > > > > return this
> > > > > > > > > by email and then delete it.
> > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > > > Subject: Howto integrate JPA within EJB2.1 
> > > session beans?
> > > > > > > > > > [architecture]
> > > > > > > > > >
> > > > > > > > > > Hi together,
> > > > > > > > > >
> > > > > > > > > > I'm sorry for bothering you with numerous basic 
> > > questions
> > > > > > > > > > regarding OpenJPA and its usage but I have 
> to migrate
> > > > > > > > > > existing CMP EJBs to migrate within short time 
> > > to OpenJPA as
> > > > > > > > > > we're having stability issues with the current 
> > > CMP engine.
> > > > > > > > > >
> > > > > > > > > > One last question I'd like to ask is regarding the
> > > > > > > > > > recommended architecture of using OpenJPA 
> within EJB2.1
> > > > > > > > > > Stateless sessino beans:
> > > > > > > > > >
> > > > > > > > > > I need to work with persistence i.e. the 
> EntityManager
> > > > > > > > > > throughout all the session beans methods so my 
> > > idea is to:
> > > > > > > > > >
> > > > > > > > > > - create a EntityManagerFactory in the 
> > > ejbCreate() method
> > > > > > > > of the SLSB
> > > > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > > > ejbCreeate() method and store it as a 
> member variable
> > > > > > > of the SLSB
> > > > > > > > > > - this would allow easy access within the SB's 
> > > methods by
> > > > > > > > > > just using the already initialized entity 
> > > manager varialbe
> > > > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > > > - clean up should be performed in the 
> ejbRemove() method
> > > > > > > > of the SLSB
> > > > > > > > > >
> > > > > > > > > > I think doing so will allow migratino to 
> > > openJPA with less
> > > > > > > > > > work than doing the whole lookup procedure in 
> > > every method
> > > > > > > > > > separately.
> > > > > > > > > >
> > > > > > > > > > what do you think? are there any pitfalls i've 
> > > overlooked?
> > > > > > > > > >
> > > > > > > > > > thank you for your ideas!
> > > > > > > > > >
> > > > > > > > > > regards
> > > > > > > > > > Hans
> > > > > > > > > > --
> > > > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > > > Jetzt GMX ProMail testen:
> > > > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > Jetzt GMX ProMail testen:
> > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > 
> > > 
> 
> -- 
> "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out
> 

Re: RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Hans Prueller <ha...@gmx.net>.
strange. 

When I look on the code it seems that it definitely could NOT be the case that the EMF is not correctly bound to the JNDI tree as the method OpenJPAEntityManagerFactory createEntityManagerFactory does no create for itself. 
So somehow the EMF must be bound to the JNDI tree but nevertheless I can see the init-logmessages evertime I access it from JNDI...

I will try to provide more detailed information.

Would it be helpful if I provide the output of "Thread.dumpStack()" within
the invocation of my PersistenceService.getEntityManager() method?

regards,
hans


-------- Original-Nachricht --------
Datum: Mon, 26 Feb 2007 23:10:42 -0800
Von: "Patrick Linskey" <pl...@bea.com>
An: open-jpa-dev@incubator.apache.org
CC: 
Betreff: RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

> It should be going through the following code:
> 
>     public static OpenJPAEntityManagerFactory createEntityManagerFactory
>         (String jndiLocation, Context context) {
>         if (jndiLocation == null)
>             throw new NullPointerException("jndiLocation == null");
> 
>         try {
>             if (context == null)
>                 context = new InitialContext();
> 
>             Object o = context.lookup(jndiLocation);
>             return (OpenJPAEntityManagerFactory)
> PortableRemoteObject.narrow(o,
>                 OpenJPAEntityManagerFactory.class);
>         } catch (NamingException ne) {
>             throw new ArgumentException(_loc.get("naming-exception",
>                 jndiLocation), new Throwable[]{ ne }, null, true);
>         }
>     }
> 
> I don't see anything in there that would be causing a creation to happen.
> But maybe something funky is happening with JNDI serializing the factory
> and then deserializing it or something.
> 
> Do you have any means of getting a stack from where the creation is
> happening? It'd be great to get a bit more context about what's going on.
> 
> -Patrick
> 
> -- 
> Patrick Linskey
> BEA Systems, Inc. 
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it. 
> 
> > -----Original Message-----
> > From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> > Sent: Saturday, February 24, 2007 10:36 PM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: EMF JNDI lookup is starting openJPA every time - 
> > was: Howto integrate JPA within EJB2.1 session beans? 
> > 
> > Hi together, Patrick,
> > 
> > the code you suggested for doing a helper method that deals 
> > with the EMF
> > JNDI lookup and the EM creating within our J2EE1.4 app 
> > basically works fine,
> > but as you perhaps may remember I asked why the method is 
> > called "create":
> > 
> > EntityManagerFactory myemf =
> > OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> > (Context)null);
> > 
> > It seems that the method above really creates a NEW EMF on 
> > every invocation!
> > I checked the logs of my application and I see the following 
> > messages on
> > every invocation of my PersistenceService.getEntityManger() 
> > method (which
> > does the above lookup and some more ..)
> > 
> > 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager 
> > : creating a
> > fresh
> > , clean EntityManager from JNDI EMF.
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.Runtime -
> > Starti
> > ng OpenJPA 0.9.7-incubating-SNAPSHOT
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.jdbc.JDBC -
> > Open
> > JPA will now connect to the database to attempt to determine 
> > what type of
> > databa
> > se dictionary to use.  To prevent this connection in the 
> > future, set your
> > openjp
> > a.jdbc.DBDictionary configuration property to the appropriate 
> > value for your
> > dat
> > abase (see the documentation for available values).
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.jdbc.JDBC -
> > Usin
> > g dictionary class 
> > "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL
> > 5.0.27-c
> > ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
> > 2006-10-19
> >  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> > 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> > openjpa.MetaData -
> > Found
> >  1 classes with metadata in 0 milliseconds.
> > 
> > 
> > It seems that OpenJPA is now bootstrapping everytime I access it. I am
> > binding the EMF somewhen at bootstrapping time with
> > 
> > final EntityManagerFactory emFactory = Persistence
> > 				.createEntityManagerFactory("lbsims");
> > 
> > Context ictx = new InitialContext();
> > ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> > 
> > The lookup uses the same constants, so the EMF in JNDI should 
> > be found?
> > 
> > EntityManagerFactory emf = OpenJPAPersistence
> > 	
> > .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> > 
> > Any Idea what could be wrong here?
> > 
> > regards,
> > HANS
> > 
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > Gesendet: Freitag, 23. Februar 2007 18:46
> > > An: open-jpa-dev@incubator.apache.org
> > > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
> > > [architecture]
> > > 
> > > Typo indeed. It should be 
> > OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > > about that.
> > > 
> > > -Patrick
> > > 
> > > --
> > > Patrick Linskey
> > > BEA Systems, Inc.
> > > 
> > > 
> > ______________________________________________________________
> > _________
> > > Notice:  This email message, together with any attachments, 
> > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and 
> >  affiliated
> > > entities,  that may be confidential,  proprietary,  
> > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of 
> > the individual
> > > or entity named in this message. If you are not the 
> > intended recipient,
> > > and have received this message in error, please immediately 
> > return this
> > > by email and then delete it.
> > > 
> > > > -----Original Message-----
> > > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > > Sent: Friday, February 23, 2007 9:43 AM
> > > > To: open-jpa-dev@incubator.apache.org
> > > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > > > beans? [architecture]
> > > >
> > > > Patrick,
> > > >
> > > > I'm currently trying your tip with a PersistenceService util
> > > > class doing
> > > > the lookup of a synchronized entity manager. The problem is
> > > > that your sample
> > > > code does not work!
> > > >
> > > > in fact the statement
> > > >
> > > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > >
> > > > is the problem. the above "cast" does not return a
> > > > BrokerFactory instance!
> > > >
> > > > I am using a 2 days old nightly snapshot 0.9.7 build
> > > >
> > > > Where is the problem?
> > > >
> > > > Hans
> > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > > An: open-jpa-dev@incubator.apache.org
> > > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1 
> > session beans?
> > > > > [architecture]
> > > > >
> > > > > > Unfortunately, that means that we're using a synchronized
> > > > > > block during the lookup. If it looks like EM lookup is a
> > > > > > scalability issue for your app, do let us know -- it would
> > > > > > be pretty straightforward to replace the synchronized block
> > > > > > with a concurrent map.
> > > > >
> > > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > > tracks the
> > > > > issue; I've got a patch that I'll submit once some more
> > > > eyes look at it.
> > > > >
> > > > > -Patrick
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > BEA Systems, Inc.
> > > > >
> > > > >
> > > > ______________________________________________________________
> > > > _________
> > > > > Notice:  This email message, together with any attachments,
> > > > may contain
> > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > >  affiliated
> > > > > entities,  that may be confidential,  proprietary,
> > > > copyrighted  and/or
> > > > > legally privileged, and is intended solely for the use of
> > > > the individual
> > > > > or entity named in this message. If you are not the
> > > > intended recipient,
> > > > > and have received this message in error, please immediately
> > > > return this
> > > > > by email and then delete it.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > > > beans? [architecture]
> > > > > >
> > > > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > > > onserver startup like.
> > > > > > >
> > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > >
> > > > > > Yep.
> > > > > >
> > > > > > >         //does the statement below again create a NEW EMF
> > > > > > or ist this
> > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > called "Create"
> > > > > > >         //and not get?
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > >
> > > > > > It's just a lookup. I'm not sure why it's called 
> > 'create'. Anyone?
> > > > > >
> > > > > > >         //why do I have to create a new
> > > > > > broker/entitymanager this way?
> > > > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > > > transaction
> > > > > > >         //context with the newly created entitymanager?
> > > > > >
> > > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > > all create new
> > > > > > EMs. The broker code will look up one associated with 
> > the current
> > > > > > transaction, which is what you're looking for.
> > > > > >
> > > > > > Unfortunately, that means that we're using a synchronized
> > > > block during
> > > > > > the lookup. If it looks like EM lookup is a scalability
> > > > issue for your
> > > > > > app, do let us know -- it would be pretty straightforward to
> > > > > > replace the
> > > > > > synchronized block with a concurrent map.
> > > > > >
> > > > > > > So if understand that right I just would have to call
> > > > > > >
> > > > > > > PersistenceService.getEntitymanager();
> > > > > > >
> > > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > > > > >
> > > > > > Yep.
> > > > > >
> > > > > > > I really appreciate your help - it's quite complex 
> > to integrate
> > > > > > > JPA into an existing Java2EE 1.4 AppServer 
> > environment.. *puh*
> > > > > >
> > > > > > Yes -- sorry about that. We should at least be creating
> > > > > > better-designed
> > > > > > helper methods in OpenJPA to help out with this.
> > > > > >
> > > > > > One alternative, of course, is to use Spring 2, which does a
> > > > > > pretty good
> > > > > > job of JPA bootstrapping.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > BEA Systems, Inc.
> > > > > >
> > > > > > ______________________________________________________________
> > > > > > _________
> > > > > > Notice:  This email message, together with any attachments,
> > > > > > may contain
> > > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > > > affiliated
> > > > > > entities,  that may be confidential,  proprietary,
> > > > > > copyrighted  and/or
> > > > > > legally privileged, and is intended solely for the use of the
> > > > > > individual
> > > > > > or entity named in this message. If you are not the intended
> > > > > > recipient,
> > > > > > and have received this message in error, please immediately
> > > > > > return this
> > > > > > by email and then delete it.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > > open-jpa-dev@incubator.apache.org
> > > > > > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session
> > > > > > > beans? [architecture]
> > > > > > >
> > > > > > > Patrick,
> > > > > > >
> > > > > > > thank you for that tip. To be true, I was not aware of
> > > > > > > lifecycle related problems between my SLSBs and JPA - thank
> > > > > > > you for that hint. As I want to avoid working with
> > > > > > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > > >
> > > > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > > > onserver startup like.
> > > > > > >
> > > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > > >
> > > > > > > I would be interested what the code for the
> > > > > > > PersistenceService class does:
> > > > > > >
> > > > > > >
> > > > > > >         //does the statement below again create a NEW EMF
> > > > > > or ist this
> > > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > > called "Create"
> > > > > > >         //and not get?
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > > >
> > > > > > >         //why do i have to cast the EMF to a
> > > > brokerfactory now? I
> > > > > > >         //would guess the "broker" is something like a
> > > > more abstract
> > > > > > >         //concept of entitymanager(factory)?
> > > > > > >
> > > > > > >         //why do I have to create a new
> > > > > > broker/entitymanager this way?
> > > > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > > > transaction
> > > > > > >         //context with the newly created entitymanager?
> > > > > > >
> > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > >         Broker b = bf.newBroker(
> > > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > > >           true, // the broker is part of a JTA managed tx
> > > > > > >
> > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > >           true); // look for an existing Broker on the tx
> > > > > > >
> > > > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > >         
> > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > >         broker.setDetachedNew(false);
> > > > > > >
> > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > >     }
> > > > > > >
> > > > > > > So if understand that right I just would have to call
> > > > > > >
> > > > > > > PersistenceService.getEntitymanager();
> > > > > > >
> > > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine. I
> > > > > > > really appreciate your help - it's quite complex to 
> > integrate
> > > > > > > JPA into an existing Java2EE 1.4 AppServer 
> > environment.. *puh*
> > > > > > >
> > > > > > > regards
> > > > > > > Hans
> > > > > > >
> > > > > > > -------- Original-Nachricht --------
> > > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > > CC:
> > > > > > > Betreff: RE: Howto integrate JPA within EJB2.1 
> > session beans?
> > > > > > > [architecture]
> > > > > > >
> > > > > > > > Another common technique is to get an EMF into 
> > JNDI, either
> > > > > > > by using a
> > > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > > >
> > > > > > > > Are you looking to integrate OpenJPA with your 
> > current managed
> > > > > > > > transaction? If so, I'd be careful about creating an EM in
> > > > > > > ejbCreate(),
> > > > > > > > as its lifecycle is related to the life of the SLSB,
> > > > not to the
> > > > > > > > transactional context (the SLSB might be pooled). So, I'd
> > > > > > > just try to
> > > > > > > > get the EMF into JNDI when the server starts 
> > (creating EMFs
> > > > > > > is slow).
> > > > > > > > Then, you could avoid having to use your own ThreadLocal
> > > > > > > work by using
> > > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > > >
> > > > > > > > public class PersistenceService {
> > > > > > > >     public static EntityManager getEntityManager() {
> > > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > > >             .createEntityManagerFactory(
> > > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > > >         Broker b = bf.newBroker(
> > > > > > > >             bf.getConfiguration().getConnectionUserName(),
> > > > > > > >             bf.getConfiguration().getConnectionPassword(),
> > > > > > > >             true, // the broker is part of a JTA 
> > managed tx
> > > > > > > >
> > > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > > >             true); // look for an existing Broker 
> > on the tx
> > > > > > > >
> > > > > > > >         // do some JPA configuration setup. Logic 
> > stolen from
> > > > > > > >         // EntityManagerFactoryImpl.
> > > > > > > >         
> > broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > > >
> > > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > > >         broker.setDetachedNew(false);
> > > > > > > >
> > > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > > >     }
> > > > > > > > }
> > > > > > > >
> > > > > > > > Meanwhile, we really should add a couple new
> > > > OpenJPAPersistence /
> > > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > > this type of
> > > > > > > > bootstrapping.
> > > > > > > >
> > > > > > > > -Patrick
> > > > > > > >
> > > > > > > > --
> > > > > > > > Patrick Linskey
> > > > > > > > BEA Systems, Inc.
> > > > > > > >
> > > > > > > >
> > > > > > > 
> > ______________________________________________________________
> > > > > > > _________
> > > > > > > > Notice:  This email message, together with any 
> > attachments,
> > > > > > > may contain
> > > > > > > > information  of  BEA Systems,  Inc.,  its 
> > subsidiaries  and
> > > > > > >  affiliated
> > > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > > copyrighted  and/or
> > > > > > > > legally privileged, and is intended solely for the use of
> > > > > > > the individual
> > > > > > > > or entity named in this message. If you are not the
> > > > > > > intended recipient,
> > > > > > > > and have received this message in error, please 
> > immediately
> > > > > > > return this
> > > > > > > > by email and then delete it.
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > > Subject: Howto integrate JPA within EJB2.1 
> > session beans?
> > > > > > > > > [architecture]
> > > > > > > > >
> > > > > > > > > Hi together,
> > > > > > > > >
> > > > > > > > > I'm sorry for bothering you with numerous basic 
> > questions
> > > > > > > > > regarding OpenJPA and its usage but I have to migrate
> > > > > > > > > existing CMP EJBs to migrate within short time 
> > to OpenJPA as
> > > > > > > > > we're having stability issues with the current 
> > CMP engine.
> > > > > > > > >
> > > > > > > > > One last question I'd like to ask is regarding the
> > > > > > > > > recommended architecture of using OpenJPA within EJB2.1
> > > > > > > > > Stateless sessino beans:
> > > > > > > > >
> > > > > > > > > I need to work with persistence i.e. the EntityManager
> > > > > > > > > throughout all the session beans methods so my 
> > idea is to:
> > > > > > > > >
> > > > > > > > > - create a EntityManagerFactory in the 
> > ejbCreate() method
> > > > > > > of the SLSB
> > > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > > ejbCreeate() method and store it as a member variable
> > > > > > of the SLSB
> > > > > > > > > - this would allow easy access within the SB's 
> > methods by
> > > > > > > > > just using the already initialized entity 
> > manager varialbe
> > > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > > - clean up should be performed in the ejbRemove() method
> > > > > > > of the SLSB
> > > > > > > > >
> > > > > > > > > I think doing so will allow migratino to 
> > openJPA with less
> > > > > > > > > work than doing the whole lookup procedure in 
> > every method
> > > > > > > > > separately.
> > > > > > > > >
> > > > > > > > > what do you think? are there any pitfalls i've 
> > overlooked?
> > > > > > > > >
> > > > > > > > > thank you for your ideas!
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > > Hans
> > > > > > > > > --
> > > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > > Jetzt GMX ProMail testen:
> > > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > Jetzt GMX ProMail testen:
> > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > >
> > > > > >
> > > >
> > > >
> > 
> > 

-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out

RE: EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by Patrick Linskey <pl...@bea.com>.
It should be going through the following code:

    public static OpenJPAEntityManagerFactory createEntityManagerFactory
        (String jndiLocation, Context context) {
        if (jndiLocation == null)
            throw new NullPointerException("jndiLocation == null");

        try {
            if (context == null)
                context = new InitialContext();

            Object o = context.lookup(jndiLocation);
            return (OpenJPAEntityManagerFactory) PortableRemoteObject.narrow(o,
                OpenJPAEntityManagerFactory.class);
        } catch (NamingException ne) {
            throw new ArgumentException(_loc.get("naming-exception",
                jndiLocation), new Throwable[]{ ne }, null, true);
        }
    }

I don't see anything in there that would be causing a creation to happen. But maybe something funky is happening with JNDI serializing the factory and then deserializing it or something.

Do you have any means of getting a stack from where the creation is happening? It'd be great to get a bit more context about what's going on.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> Sent: Saturday, February 24, 2007 10:36 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: EMF JNDI lookup is starting openJPA every time - 
> was: Howto integrate JPA within EJB2.1 session beans? 
> 
> Hi together, Patrick,
> 
> the code you suggested for doing a helper method that deals 
> with the EMF
> JNDI lookup and the EM creating within our J2EE1.4 app 
> basically works fine,
> but as you perhaps may remember I asked why the method is 
> called "create":
> 
> EntityManagerFactory myemf =
> OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
> (Context)null);
> 
> It seems that the method above really creates a NEW EMF on 
> every invocation!
> I checked the logs of my application and I see the following 
> messages on
> every invocation of my PersistenceService.getEntityManger() 
> method (which
> does the above lookup and some more ..)
> 
> 2007-02-25 07:27:05,687 : PersistenceService.getEntityManager 
> : creating a
> fresh
> , clean EntityManager from JNDI EMF.
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.Runtime -
> Starti
> ng OpenJPA 0.9.7-incubating-SNAPSHOT
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.jdbc.JDBC -
> Open
> JPA will now connect to the database to attempt to determine 
> what type of
> databa
> se dictionary to use.  To prevent this connection in the 
> future, set your
> openjp
> a.jdbc.DBDictionary configuration property to the appropriate 
> value for your
> dat
> abase (see the documentation for available values).
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.jdbc.JDBC -
> Usin
> g dictionary class 
> "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL
> 5.0.27-c
> ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
> 2006-10-19
>  17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
> 15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] 
> openjpa.MetaData -
> Found
>  1 classes with metadata in 0 milliseconds.
> 
> 
> It seems that OpenJPA is now bootstrapping everytime I access it. I am
> binding the EMF somewhen at bootstrapping time with
> 
> final EntityManagerFactory emFactory = Persistence
> 				.createEntityManagerFactory("lbsims");
> 
> Context ictx = new InitialContext();
> ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);
> 
> The lookup uses the same constants, so the EMF in JNDI should 
> be found?
> 
> EntityManagerFactory emf = OpenJPAPersistence
> 	
> .createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);
> 
> Any Idea what could be wrong here?
> 
> regards,
> HANS
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > Gesendet: Freitag, 23. Februar 2007 18:46
> > An: open-jpa-dev@incubator.apache.org
> > Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
> > [architecture]
> > 
> > Typo indeed. It should be 
> OpenJPAPersistence.toBrokerFactory(emf). Sorry
> > about that.
> > 
> > -Patrick
> > 
> > --
> > Patrick Linskey
> > BEA Systems, Inc.
> > 
> > 
> ______________________________________________________________
> _________
> > Notice:  This email message, together with any attachments, 
> may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and 
>  affiliated
> > entities,  that may be confidential,  proprietary,  
> copyrighted  and/or
> > legally privileged, and is intended solely for the use of 
> the individual
> > or entity named in this message. If you are not the 
> intended recipient,
> > and have received this message in error, please immediately 
> return this
> > by email and then delete it.
> > 
> > > -----Original Message-----
> > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > > Sent: Friday, February 23, 2007 9:43 AM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > > beans? [architecture]
> > >
> > > Patrick,
> > >
> > > I'm currently trying your tip with a PersistenceService util
> > > class doing
> > > the lookup of a synchronized entity manager. The problem is
> > > that your sample
> > > code does not work!
> > >
> > > in fact the statement
> > >
> > > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > >
> > > is the problem. the above "cast" does not return a
> > > BrokerFactory instance!
> > >
> > > I am using a 2 days old nightly snapshot 0.9.7 build
> > >
> > > Where is the problem?
> > >
> > > Hans
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > > An: open-jpa-dev@incubator.apache.org
> > > > Betreff: RE: RE: Howto integrate JPA within EJB2.1 
> session beans?
> > > > [architecture]
> > > >
> > > > > Unfortunately, that means that we're using a synchronized
> > > > > block during the lookup. If it looks like EM lookup is a
> > > > > scalability issue for your app, do let us know -- it would
> > > > > be pretty straightforward to replace the synchronized block
> > > > > with a concurrent map.
> > > >
> > > > OK, I got fed up with that synchronized block. OPENJPA-161
> > > tracks the
> > > > issue; I've got a patch that I'll submit once some more
> > > eyes look at it.
> > > >
> > > > -Patrick
> > > >
> > > > --
> > > > Patrick Linskey
> > > > BEA Systems, Inc.
> > > >
> > > >
> > > ______________________________________________________________
> > > _________
> > > > Notice:  This email message, together with any attachments,
> > > may contain
> > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > >  affiliated
> > > > entities,  that may be confidential,  proprietary,
> > > copyrighted  and/or
> > > > legally privileged, and is intended solely for the use of
> > > the individual
> > > > or entity named in this message. If you are not the
> > > intended recipient,
> > > > and have received this message in error, please immediately
> > > return this
> > > > by email and then delete it.
> > > >
> > > > > -----Original Message-----
> > > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > > To: open-jpa-dev@incubator.apache.org
> > > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > > beans? [architecture]
> > > > >
> > > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > > onserver startup like.
> > > > > >
> > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > >
> > > > > Yep.
> > > > >
> > > > > >         //does the statement below again create a NEW EMF
> > > > > or ist this
> > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > called "Create"
> > > > > >         //and not get?
> > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > >             .createEntityManagerFactory(
> > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > >
> > > > > It's just a lookup. I'm not sure why it's called 
> 'create'. Anyone?
> > > > >
> > > > > >         //why do I have to create a new
> > > > > broker/entitymanager this way?
> > > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > > transaction
> > > > > >         //context with the newly created entitymanager?
> > > > >
> > > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > > all create new
> > > > > EMs. The broker code will look up one associated with 
> the current
> > > > > transaction, which is what you're looking for.
> > > > >
> > > > > Unfortunately, that means that we're using a synchronized
> > > block during
> > > > > the lookup. If it looks like EM lookup is a scalability
> > > issue for your
> > > > > app, do let us know -- it would be pretty straightforward to
> > > > > replace the
> > > > > synchronized block with a concurrent map.
> > > > >
> > > > > > So if understand that right I just would have to call
> > > > > >
> > > > > > PersistenceService.getEntitymanager();
> > > > > >
> > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > > > >
> > > > > Yep.
> > > > >
> > > > > > I really appreciate your help - it's quite complex 
> to integrate
> > > > > > JPA into an existing Java2EE 1.4 AppServer 
> environment.. *puh*
> > > > >
> > > > > Yes -- sorry about that. We should at least be creating
> > > > > better-designed
> > > > > helper methods in OpenJPA to help out with this.
> > > > >
> > > > > One alternative, of course, is to use Spring 2, which does a
> > > > > pretty good
> > > > > job of JPA bootstrapping.
> > > > >
> > > > > -Patrick
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > BEA Systems, Inc.
> > > > >
> > > > > ______________________________________________________________
> > > > > _________
> > > > > Notice:  This email message, together with any attachments,
> > > > > may contain
> > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > > affiliated
> > > > > entities,  that may be confidential,  proprietary,
> > > > > copyrighted  and/or
> > > > > legally privileged, and is intended solely for the use of the
> > > > > individual
> > > > > or entity named in this message. If you are not the intended
> > > > > recipient,
> > > > > and have received this message in error, please immediately
> > > > > return this
> > > > > by email and then delete it.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > > open-jpa-dev@incubator.apache.org
> > > > > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session
> > > > > > beans? [architecture]
> > > > > >
> > > > > > Patrick,
> > > > > >
> > > > > > thank you for that tip. To be true, I was not aware of
> > > > > > lifecycle related problems between my SLSBs and JPA - thank
> > > > > > you for that hint. As I want to avoid working with
> > > > > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > > >
> > > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > > onserver startup like.
> > > > > >
> > > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > > >
> > > > > > I would be interested what the code for the
> > > > > > PersistenceService class does:
> > > > > >
> > > > > >
> > > > > >         //does the statement below again create a NEW EMF
> > > > > or ist this
> > > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > > called "Create"
> > > > > >         //and not get?
> > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > >             .createEntityManagerFactory(
> > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > >
> > > > > >         //why do i have to cast the EMF to a
> > > brokerfactory now? I
> > > > > >         //would guess the "broker" is something like a
> > > more abstract
> > > > > >         //concept of entitymanager(factory)?
> > > > > >
> > > > > >         //why do I have to create a new
> > > > > broker/entitymanager this way?
> > > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > > transaction
> > > > > >         //context with the newly created entitymanager?
> > > > > >
> > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > >         Broker b = bf.newBroker(
> > > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > > >           true, // the broker is part of a JTA managed tx
> > > > > >
> > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > >           true); // look for an existing Broker on the tx
> > > > > >
> > > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > >         broker.setDetachedNew(false);
> > > > > >
> > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > >     }
> > > > > >
> > > > > > So if understand that right I just would have to call
> > > > > >
> > > > > > PersistenceService.getEntitymanager();
> > > > > >
> > > > > > in every SLSB method (NOT in ejbCreate) when needed? fine. I
> > > > > > really appreciate your help - it's quite complex to 
> integrate
> > > > > > JPA into an existing Java2EE 1.4 AppServer 
> environment.. *puh*
> > > > > >
> > > > > > regards
> > > > > > Hans
> > > > > >
> > > > > > -------- Original-Nachricht --------
> > > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > > An: open-jpa-dev@incubator.apache.org
> > > > > > CC:
> > > > > > Betreff: RE: Howto integrate JPA within EJB2.1 
> session beans?
> > > > > > [architecture]
> > > > > >
> > > > > > > Another common technique is to get an EMF into 
> JNDI, either
> > > > > > by using a
> > > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > > >
> > > > > > > Are you looking to integrate OpenJPA with your 
> current managed
> > > > > > > transaction? If so, I'd be careful about creating an EM in
> > > > > > ejbCreate(),
> > > > > > > as its lifecycle is related to the life of the SLSB,
> > > not to the
> > > > > > > transactional context (the SLSB might be pooled). So, I'd
> > > > > > just try to
> > > > > > > get the EMF into JNDI when the server starts 
> (creating EMFs
> > > > > > is slow).
> > > > > > > Then, you could avoid having to use your own ThreadLocal
> > > > > > work by using
> > > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > > >
> > > > > > > public class PersistenceService {
> > > > > > >     public static EntityManager getEntityManager() {
> > > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > > >             .createEntityManagerFactory(
> > > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > > >         Broker b = bf.newBroker(
> > > > > > >             bf.getConfiguration().getConnectionUserName(),
> > > > > > >             bf.getConfiguration().getConnectionPassword(),
> > > > > > >             true, // the broker is part of a JTA 
> managed tx
> > > > > > >
> > > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > > >             true); // look for an existing Broker 
> on the tx
> > > > > > >
> > > > > > >         // do some JPA configuration setup. Logic 
> stolen from
> > > > > > >         // EntityManagerFactoryImpl.
> > > > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > > >
> > > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > > >         broker.setDetachedNew(false);
> > > > > > >
> > > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > > >     }
> > > > > > > }
> > > > > > >
> > > > > > > Meanwhile, we really should add a couple new
> > > OpenJPAPersistence /
> > > > > > > OpenJPAEntityManagerFactory methods to help out with
> > > this type of
> > > > > > > bootstrapping.
> > > > > > >
> > > > > > > -Patrick
> > > > > > >
> > > > > > > --
> > > > > > > Patrick Linskey
> > > > > > > BEA Systems, Inc.
> > > > > > >
> > > > > > >
> > > > > > 
> ______________________________________________________________
> > > > > > _________
> > > > > > > Notice:  This email message, together with any 
> attachments,
> > > > > > may contain
> > > > > > > information  of  BEA Systems,  Inc.,  its 
> subsidiaries  and
> > > > > >  affiliated
> > > > > > > entities,  that may be confidential,  proprietary,
> > > > > > copyrighted  and/or
> > > > > > > legally privileged, and is intended solely for the use of
> > > > > > the individual
> > > > > > > or entity named in this message. If you are not the
> > > > > > intended recipient,
> > > > > > > and have received this message in error, please 
> immediately
> > > > > > return this
> > > > > > > by email and then delete it.
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > > Subject: Howto integrate JPA within EJB2.1 
> session beans?
> > > > > > > > [architecture]
> > > > > > > >
> > > > > > > > Hi together,
> > > > > > > >
> > > > > > > > I'm sorry for bothering you with numerous basic 
> questions
> > > > > > > > regarding OpenJPA and its usage but I have to migrate
> > > > > > > > existing CMP EJBs to migrate within short time 
> to OpenJPA as
> > > > > > > > we're having stability issues with the current 
> CMP engine.
> > > > > > > >
> > > > > > > > One last question I'd like to ask is regarding the
> > > > > > > > recommended architecture of using OpenJPA within EJB2.1
> > > > > > > > Stateless sessino beans:
> > > > > > > >
> > > > > > > > I need to work with persistence i.e. the EntityManager
> > > > > > > > throughout all the session beans methods so my 
> idea is to:
> > > > > > > >
> > > > > > > > - create a EntityManagerFactory in the 
> ejbCreate() method
> > > > > > of the SLSB
> > > > > > > > - and also create the EntityManager itself in the
> > > > > > > > ejbCreeate() method and store it as a member variable
> > > > > of the SLSB
> > > > > > > > - this would allow easy access within the SB's 
> methods by
> > > > > > > > just using the already initialized entity 
> manager varialbe
> > > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > > - clean up should be performed in the ejbRemove() method
> > > > > > of the SLSB
> > > > > > > >
> > > > > > > > I think doing so will allow migratino to 
> openJPA with less
> > > > > > > > work than doing the whole lookup procedure in 
> every method
> > > > > > > > separately.
> > > > > > > >
> > > > > > > > what do you think? are there any pitfalls i've 
> overlooked?
> > > > > > > >
> > > > > > > > thank you for your ideas!
> > > > > > > >
> > > > > > > > regards
> > > > > > > > Hans
> > > > > > > > --
> > > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > > Jetzt GMX ProMail testen:
> > > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > > >
> > > > > >
> > > > > > --
> > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > Jetzt GMX ProMail testen:
> > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > >
> > > > >
> > >
> > >
> 
> 

Re: Test failure @ svn revision 511041

Posted by Marc Prud'hommeaux <mp...@apache.org>.
I've gone ahead and removed the propertyaccess test. In general,  
removing tests shouldn't be the way to address a test failure, but  
since I am pretty sure this is a Derby bug, and we don't have any  
infrastructure for skipping certain tests for certain databases, I  
think the quick and dirty solution is OK for right now.

Please let me know if anyone else experiences these failures when  
running against any other of the tests.



On Feb 27, 2007, at 1:46 AM, Patrick Linskey wrote:

> If I remove that file and run 'mvn clean test', everything passes.
>
> -Patrick
>
> -- 
> Patrick Linskey
> BEA Systems, Inc.
>
> ______________________________________________________________________ 
> _
> Notice:  This email message, together with any attachments, may  
> contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and   
> affiliated
> entities,  that may be confidential,  proprietary,  copyrighted   
> and/or
> legally privileged, and is intended solely for the use of the  
> individual
> or entity named in this message. If you are not the intended  
> recipient,
> and have received this message in error, please immediately return  
> this
> by email and then delete it.
>
>> -----Original Message-----
>> From: Marc Prud'hommeaux [mailto:mprudhomapache@gmail.com] On
>> Behalf Of Marc Prud'hommeaux
>> Sent: Monday, February 26, 2007 3:19 PM
>> To: open-jpa-dev@incubator.apache.org
>> Subject: Re: Test failure @ svn revision 511041
>>
>> All-
>>
>> Sorry for the long delay in looking into this (I was on vacation). I
>> can't imagine that this is anything but a bug in Derby, since it is
>> an NPE coming from Derby code (and it is a seemingly valid SQL
>> statement that intermittently works). However, I can't get it to
>> happen (on OS X).
>>
>> For those people who experience the problem, what happens if you
>> delete the TestPropertyCompanyModel.java and re-run? Does the
>> problem
>> re-appear elsewhere, or does it go away? If the latter, we
>> might just
>> remove that one test.
>>
>>
>>
>> On Feb 23, 2007, at 11:34 PM, Michael Dick wrote:
>>
>>> Well my logging workaround is probably due to something
>> else screwy
>>> in my
>>> environment. I can get the tests to pass on two Linux boxes, but
>>> not on
>>> Windows. The snapshot builds were updated yesterday morning so it
>>> looks like
>>> the continuum servers are working.
>>>
>>> Sorry for the false alarm earlier. Nothing to see here,
>> move along :-)
>>>
>>> On 2/23/07, Craig L Russell <Cr...@sun.com> wrote:
>>>>
>>>> I still get failures on the checked-out HEAD.
>>>>
>>>> Updated to revision 511104.
>>>> %mvn install
>>>> [INFO] Scanning for projects...
>>>> [INFO] Reactor build order:
>>>> [INFO]   OpenJPA
>>>> [INFO]   OpenJPA Utilities
>>>> [INFO]   OpenJPA Kernel
>>>> [INFO]   OpenJPA JDBC
>>>> [INFO]   OpenJPA XML Store
>>>> [INFO]   OpenJPA JDBC 1.5
>>>> [INFO]   OpenJPA Kernel 1.5
>>>> [INFO]   OpenJPA JPA
>>>> [INFO]   OpenJPA JPA JDBC
>>>> [INFO]   OpenJPA Aggregate Jar
>>>> [INFO]   OpenJPA Persistence Examples
>>>> [INFO]   OpenJPA Distribution
>>>> [INFO]   OpenJPA Integration Tests
>>>> [INFO]   OpenJPA Examples Integration Tests
>>>> [INFO]   OpenJPA JPA TCK Integration Tests
>>>> ...
>>>>
>>>> Running
>>>>
>> org.apache.openjpa.persistence.models.company.propertyaccess.TestProp
>>>> ert
>>>> yCompanyModel
>>>> 1  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.0.0
>>>> 10  test  INFO   [main] openjpa.jdbc.JDBC - OpenJPA will
>> now connect
>>>> to the database to attempt to determine what type of database
>>>> dictionary to use.  To prevent this connection in the future, set
>>>> your openjpa.jdbc.DBDictionary configuration property to the
>>>> appropriate value for your database (see the documentation for
>>>> available values).
>>>> 16  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
>>>> "org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache
>> Derby 10.2.2.0
>>>> - (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
>>>> 22  test  INFO   [main] openjpa.MetaData - Found 10 classes with
>>>> metadata in 1 milliseconds.
>>>> 30  test  INFO   [main] openjpa.MetaData - Found 10 classes with
>>>> metadata in 1 milliseconds.
>>>> 31  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim
>>>> eEm
>>>> ployee".
>>>> 32  test  INFO   [main] openjpa.MetaData - Parsing package
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim
>>>> eEm
>>>> ployee".
>>>> 43  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Employe
>>>> e".
>>>> 51  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Person"
>>>> .
>>>> 58  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Address
>>>> ".
>>>> 68  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Company
>>>> ".
>>>> 140  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product
>>>> ".
>>>> 156  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.LineIte
>>>> m".
>>>> 164  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Custome
>>>> r".
>>>> 172  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product
>>>> Ord
>>>> er".
>>>> 183  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTim
>>>> eEm
>>>> ployee".
>>>> 219  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name "PRP_Address".
>>>> 227  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name "PRP_Company".
>>>> 235  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name "PRP_LineItem".
>>>> 313  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name "PRP_Person".
>>>> 324  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name "PRP_Product".
>>>> 369  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name "PRP_ProductOrder".
>>>> 378  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name
>>>> "PRP_ProductOrder_PRP_LineItem".
>>>> 385  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>>>> information for schema name "null", table name
>>>> "PRP_Product_PRP_Company".
>>>> 446  test  INFO   [main] openjpa.jdbc.Schema - Reading sequence
>>>> information for schema "null", sequence name "null".
>>>> 480  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Company
>>>> ".
>>>> 482  test  INFO   [main] openjpa.MetaData - Parsing package
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Company
>>>> ".
>>>> 512  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Address
>>>> ".
>>>> 518  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Employe
>>>> e".
>>>> 524  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Person"
>>>> .
>>>> 533  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product
>>>> ".
>>>> 540  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim
>>>> eEm
>>>> ployee".
>>>> 722  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product
>>>> Ord
>>>> er".
>>>> 733  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Custome
>>>> r".
>>>> 740  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.LineIte
>>>> m".
>>>> 873  test  INFO   [main] openjpa.MetaData - Parsing class
>>>>
>> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTim
>>>> eEm
>>>> ployee".
>>>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
>>>> 63.348 sec <<< FAILURE!
>>>> testBasicQueries
>>>>
>> (org.apache.openjpa.persistence.models.company.propertyaccess.TestPro
>>>> per
>>>> tyCompanyModel)  Time elapsed: 63.322 sec  <<< ERROR!
>>>> <0|false|0.0.0>
>> org.apache.openjpa.persistence.PersistenceException:
>>>> The exception 'java.lang.NullPointerException' was thrown while
>>>> evaluating an expression. {prepstmnt 6533344 SELECT t0.id,
>> t0.DTYPE,
>>>> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
>>>> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
>>>> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
>>>> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
>>>> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
>>>> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM
>> PRP_Person t0 LEFT
>>>> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
>>>> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
>>>> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
>>>> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST
>>>> (ABS
>>>> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
>>>> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
>>>> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS
>> VARCHAR(1000)))
>>>> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
>>>> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
>>>> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS
>> BIGINT) OR
>>>> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR
>> CAST(((LOCATE
>>>> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
>>>> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER)
>> + 1) - 1)
>>>> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
>>>> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
>>>> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) +
>> 1) - 1) + ?)
>>>> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
>>>> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(?
>> AS BIGINT)
>>>> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS
>> BIGINT) > CAST(?
>>>> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) =
>> ? OR LOWER
>>>> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
>>>> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE)
>> <> CAST(?
>>>> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS
>> DOUBLE) OR
>>>> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
>>>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? +
>> (CAST(? AS
>>>> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(?
>> AS BIGINT)
>>>> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
>>>> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS
>> BIGINT))) AS
>>>> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS
>> BIGINT)))) AS
>>>> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
>>>> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST
>>>> (((CAST
>>>> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1,
>> CAST(((? + (CAST
>>>> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
>>>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR
>> LTRIM(t1.firstName)
>>>> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
>>>> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
>>>> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS
>> VARCHAR(1000))) = ? OR
>>>> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
>>>> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
>>>> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
>>>> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
>>>> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
>>>> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
>>>> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id
>> IS NOT NULL
>>>> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR
>> t1.lastName IS
>>>> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
>>>> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
>>>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS
>> REAL) OR CAST
>>>> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
>>>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
>>>> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS
>> NOT NULL OR
>>>> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long)
>> 0, (long)
>>>> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,
>> (long) 0,
>>>> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String)
>> x, (long)
>>>> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
>>>> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0,
>> (long) 0,
>>>> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
>>>> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int)
>> 1, (long) 1,
>>>> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long)
>> 1, (int) 1,
>>>> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
>>>> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
>>>> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long)
>> 0, (long) 0,
>>>> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
>>>> (String) PartTimeEmployee]} [code=30000, state=38000]
>>>>          at
>>>> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException
>>>> (DBDictionary.java:3780)
>>>>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
>>>> (SQLExceptions.java:94)
>>>>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
>>>> (SQLExceptions.java:80)
>>>>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
>>>> (SQLExceptions.java:56)
>>>>          at
>>>>
>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheck
>>>> edE
>>>> xception(SelectResultObjectProvider.java:152)
>>>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>>>> (EagerResultList.java:37)
>>>>          at org.apache.openjpa.kernel.QueryImpl.toResult
>>>> (QueryImpl.java:1214)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:981)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:791)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:761)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:757)
>>>>          at org.apache.openjpa.kernel.DelegatingQuery.execute
>>>> (DelegatingQuery.java:512)
>>>>          at org.apache.openjpa.persistence.QueryImpl.execute
>>>> (QueryImpl.java:225)
>>>>          at org.apache.openjpa.persistence.QueryImpl.getResultList
>>>> (QueryImpl.java:264)
>>>>          at org.apache.openjpa.persistence.test.SingleEMTest.find
>>>> (SingleEMTest.java:250)
>>>>          at
>>>>
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa
>>>> sic
>>>> Queries(CompanyModelTest.java:99)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at junit.framework.TestCase.runTest(TestCase.java:154)
>>>>          at junit.framework.TestCase.runBare(TestCase.java:127)
>>>>          at
>> junit.framework.TestResult$1.protect(TestResult.java:106)
>>>>          at junit.framework.TestResult.runProtected
>>>> (TestResult.java:124)
>>>>          at junit.framework.TestResult.run(TestResult.java:109)
>>>>          at junit.framework.TestCase.run(TestCase.java:118)
>>>>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>>>          at junit.framework.TestSuite.run(TestSuite.java:203)
>>>>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown
>>>> Source)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
>>>> (JUnitTestSet.java:210)
>>>>          at
>>>>
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
>>>> tSe
>>>> t(AbstractDirectoryTestSuite.java:135)
>>>>          at
>>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
>>>> (AbstractDirectoryTestSuite.java:122)
>>>>          at
>> org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at
>>>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
>>>> (SurefireBooter.java:225)
>>>>          at org.apache.maven.surefire.booter.SurefireBooter.main
>>>> (SurefireBooter.java:747)
>>>> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The
>>>> exception 'java.lang.NullPointerException' was thrown while
>>>> evaluating an expression. {prepstmnt 6533344 SELECT t0.id,
>> t0.DTYPE,
>>>> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
>>>> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
>>>> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
>>>> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
>>>> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
>>>> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM
>> PRP_Person t0 LEFT
>>>> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
>>>> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
>>>> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
>>>> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST
>>>> (ABS
>>>> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
>>>> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
>>>> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS
>> VARCHAR(1000)))
>>>> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
>>>> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
>>>> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS
>> BIGINT) OR
>>>> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR
>> CAST(((LOCATE
>>>> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
>>>> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER)
>> + 1) - 1)
>>>> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
>>>> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
>>>> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) +
>> 1) - 1) + ?)
>>>> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
>>>> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(?
>> AS BIGINT)
>>>> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS
>> BIGINT) > CAST(?
>>>> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) =
>> ? OR LOWER
>>>> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
>>>> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE)
>> <> CAST(?
>>>> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS
>> DOUBLE) OR
>>>> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
>>>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? +
>> (CAST(? AS
>>>> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(?
>> AS BIGINT)
>>>> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
>>>> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS
>> BIGINT))) AS
>>>> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS
>> BIGINT)))) AS
>>>> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
>>>> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST
>>>> (((CAST
>>>> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1,
>> CAST(((? + (CAST
>>>> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
>>>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR
>> LTRIM(t1.firstName)
>>>> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
>>>> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
>>>> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS
>> VARCHAR(1000))) = ? OR
>>>> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
>>>> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
>>>> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
>>>> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
>>>> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
>>>> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
>>>> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id
>> IS NOT NULL
>>>> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR
>> t1.lastName IS
>>>> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
>>>> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
>>>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS
>> REAL) OR CAST
>>>> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
>>>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
>>>> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS
>> NOT NULL OR
>>>> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long)
>> 0, (long)
>>>> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,
>> (long) 0,
>>>> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String)
>> x, (long)
>>>> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
>>>> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0,
>> (long) 0,
>>>> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
>>>> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int)
>> 1, (long) 1,
>>>> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long)
>> 1, (int) 1,
>>>> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
>>>> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
>>>> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long)
>> 0, (long) 0,
>>>> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
>>>> (String) PartTimeEmployee]} [code=30000, state=38000]
>>>>          at
>>>> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap
>>>> (LoggingConnectionDecorator.java:188)
>>>>          at
>>>> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800
>>>> (LoggingConnectionDecorator.java:53)
>>>>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
>>>> $LoggingConnection$LoggingPreparedStatement.executeQuery
>>>> (LoggingConnectionDecorator.java:840)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:259)
>>>>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
>>>> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:249)
>>>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>>>> (SelectImpl.java:324)
>>>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>>>> (SelectImpl.java:296)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion
>>>> $UnionSelect.execute(LogicalUnion.java:402)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>>>> (LogicalUnion.java:213)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>>>> (LogicalUnion.java:203)
>>>>          at
>>>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
>>>> (SelectResultObjectProvider.java:91)
>>>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>>>> (EagerResultList.java:31)
>>>>          ... 35 more
>>>> NestedThrowables:
>>>> ERROR 38000: The exception 'java.lang.NullPointerException' was
>>>> thrown while evaluating an expression.
>>>>          at
>>>> org.apache.derby.iapi.error.StandardException.newException
>>>> (Unknown Source)
>>>>          at
>>>>
>> org.apache.derby.iapi.error.StandardException.unexpectedUserException
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
>>>> Source)
>>>>          at
>>>>
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow
>>>> Cor
>>>> e(Unknown Source)
>>>>          at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.sql.GenericPreparedStatement.execute
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:92)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:261)
>>>>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
>>>> $LoggingConnection$LoggingPreparedStatement.executeQuery
>>>> (LoggingConnectionDecorator.java:838)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:259)
>>>>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
>>>> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:249)
>>>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>>>> (SelectImpl.java:324)
>>>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>>>> (SelectImpl.java:296)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion
>>>> $UnionSelect.execute(LogicalUnion.java:402)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>>>> (LogicalUnion.java:213)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>>>> (LogicalUnion.java:203)
>>>>          at
>>>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
>>>> (SelectResultObjectProvider.java:91)
>>>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>>>> (EagerResultList.java:31)
>>>>          at org.apache.openjpa.kernel.QueryImpl.toResult
>>>> (QueryImpl.java:1214)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:981)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:791)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:761)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:757)
>>>>          at org.apache.openjpa.kernel.DelegatingQuery.execute
>>>> (DelegatingQuery.java:512)
>>>>          at org.apache.openjpa.persistence.QueryImpl.execute
>>>> (QueryImpl.java:225)
>>>>          at org.apache.openjpa.persistence.QueryImpl.getResultList
>>>> (QueryImpl.java:264)
>>>>          at org.apache.openjpa.persistence.test.SingleEMTest.find
>>>> (SingleEMTest.java:250)
>>>>          at
>>>>
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa
>>>> sic
>>>> Queries(CompanyModelTest.java:99)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at junit.framework.TestCase.runTest(TestCase.java:154)
>>>>          at junit.framework.TestCase.runBare(TestCase.java:127)
>>>>          at
>> junit.framework.TestResult$1.protect(TestResult.java:106)
>>>>          at junit.framework.TestResult.runProtected
>>>> (TestResult.java:124)
>>>>          at junit.framework.TestResult.run(TestResult.java:109)
>>>>          at junit.framework.TestCase.run(TestCase.java:118)
>>>>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>>>          at junit.framework.TestSuite.run(TestSuite.java:203)
>>>>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown
>>>> Source)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
>>>> (JUnitTestSet.java:210)
>>>>          at
>>>>
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
>>>> tSe
>>>> t(AbstractDirectoryTestSuite.java:135)
>>>>          at
>>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
>>>> (AbstractDirectoryTestSuite.java:122)
>>>>          at
>> org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at
>>>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
>>>> (SurefireBooter.java:225)
>>>>          at org.apache.maven.surefire.booter.SurefireBooter.main
>>>> (SurefireBooter.java:747)
>>>> java.lang.NullPointerException
>>>>          at
>>>> org.apache.derby.exe.ac80a29d05x0110xf079xcde5x0000000b87880.e11
>>>> (Unknown Source)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at
>>>> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
>>>> Source)
>>>>          at
>>>>
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow
>>>> Cor
>>>> e(Unknown Source)
>>>>          at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.sql.GenericPreparedStatement.execute
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
>>>> (Unknown Source)
>>>>          at
>>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:92)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:261)
>>>>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
>>>> $LoggingConnection$LoggingPreparedStatement.executeQuery
>>>> (LoggingConnectionDecorator.java:838)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:259)
>>>>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
>>>> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>>>>          at
>>>>
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>>>> (DelegatingPreparedStatement.java:249)
>>>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>>>> (SelectImpl.java:324)
>>>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>>>> (SelectImpl.java:296)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion
>>>> $UnionSelect.execute(LogicalUnion.java:402)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>>>> (LogicalUnion.java:213)
>>>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>>>> (LogicalUnion.java:203)
>>>>          at
>>>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
>>>> (SelectResultObjectProvider.java:91)
>>>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>>>> (EagerResultList.java:31)
>>>>          at org.apache.openjpa.kernel.QueryImpl.toResult
>>>> (QueryImpl.java:1214)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:981)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:791)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:761)
>>>>          at org.apache.openjpa.kernel.QueryImpl.execute
>>>> (QueryImpl.java:757)
>>>>          at org.apache.openjpa.kernel.DelegatingQuery.execute
>>>> (DelegatingQuery.java:512)
>>>>          at org.apache.openjpa.persistence.QueryImpl.execute
>>>> (QueryImpl.java:225)
>>>>          at org.apache.openjpa.persistence.QueryImpl.getResultList
>>>> (QueryImpl.java:264)
>>>>          at org.apache.openjpa.persistence.test.SingleEMTest.find
>>>> (SingleEMTest.java:250)
>>>>          at
>>>>
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa
>>>> sic
>>>> Queries(CompanyModelTest.java:99)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at junit.framework.TestCase.runTest(TestCase.java:154)
>>>>          at junit.framework.TestCase.runBare(TestCase.java:127)
>>>>          at
>> junit.framework.TestResult$1.protect(TestResult.java:106)
>>>>          at junit.framework.TestResult.runProtected
>>>> (TestResult.java:124)
>>>>          at junit.framework.TestResult.run(TestResult.java:109)
>>>>          at junit.framework.TestCase.run(TestCase.java:118)
>>>>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>>>          at junit.framework.TestSuite.run(TestSuite.java:203)
>>>>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown
>>>> Source)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
>>>> (JUnitTestSet.java:210)
>>>>          at
>>>>
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
>>>> tSe
>>>> t(AbstractDirectoryTestSuite.java:135)
>>>>          at
>>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
>>>> (AbstractDirectoryTestSuite.java:122)
>>>>          at
>> org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>>>          at
>>>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
>>>> (SurefireBooter.java:225)
>>>>          at org.apache.maven.surefire.booter.SurefireBooter.main
>>>> (SurefireBooter.java:747)
>>>> ...
>>>> Results :
>>>> Tests run: 76, Failures: 0, Errors: 1, Skipped: 0
>>>>
>>>>
>>>> On Feb 23, 2007, at 12:20 PM, Pinaki Poddar wrote:
>>>>
>>>>>> I should have the same code as you. Did you try changing the log
>>>>> level?
>>>>> Yes I too am  at
>>>>> $svnversion -c
>>>>> 406193:511043
>>>>>
>>>>> Changing log level to error in
>> openjpa-persistence-jdbc/pom.xml did
>>>>> not
>>>>> impact the test failure.
>>>>>
>>>>>
>>>>> Pinaki Poddar
>>>>> BEA Systems
>>>>> 415.402.7317
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Michael Dick [mailto:michael.d.dick@gmail.com]
>>>>> Sent: Friday, February 23, 2007 11:58 AM
>>>>> To: open-jpa-dev@incubator.apache.org
>>>>> Subject: Re: Test failure @ svn revision 511041
>>>>>
>>>>> I think so, that's what's specified in pom.xml (except for
>>>>> openjpa-integration) and it should be picked up from there.
>>>>>
>>>>> Log entries like this show up when I run the tests :
>>>>> 17  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary
>>>> class "
>>>>> org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby
>>>> 10.2.2.0 -
>>>>> (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
>>>>>
>>>>> Svnversion -c gives me this output :
>>>>> mikedd@tessier:~/work/jpa/openjpa$ svnversion -c
>>>>> 406193:511043
>>>>>
>>>>> I should have the same code as you. Did you try changing the log
>>>>> level?
>>>>>
>>>>> On 2/23/07, Pinaki Poddar <pp...@bea.com> wrote:
>>>>>>
>>>>>> The stacktrace points that it *may* be a driver issue (the
>>>> error is
>>>>>> NPE with Derby driver and not an SQLException)
>>>>>> java.lang.NullPointerException
>>>>>>         at
>>>>>> org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11
>>>>>> (Unkno
>>>>>> wn
>>>>>> Source)
>>>>>>
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
>>>>>> Source)
>>>>>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>>>>> Source)
>>>>>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>>         at
>>>>>> org.apache.derby.impl.services.reflect.ReflectMethod.invoke
>>>> (Unknown
>>>>>> Source)
>>>>>>         at
>>>>>>
>>>>
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow
>>>>>> C
>>>>>> or
>>>>>> e(Unknown Source)
>>>>>>         at
>>>>>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
>>>>> Source)
>>>>>>         at
>>>>>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
>>>>> Source)
>>>>>>         at
>>>>>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
>>>>> Source)
>>>>>>         at
>>>>>>
>>>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
>>>>>> (Un
>>>>>> kn
>>>>>> own Source)
>>>>>>         at
>>>>>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
>>>>>> (Unknown
>>>>>> Source)
>>>>>>         at
>>>>>>
>> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>>
>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>>
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
>>>>>> (Unk
>>>>>> no
>>>>>> wn Source)
>>>>>>
>>>>>>
>>>>>> Are you using the same driver?
>>>>>>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby
>> Embedded
>>>> JDBC
>>>>>
>>>>>>> Driver 10.2.2.0 - (485682)).
>>>>>>
>>>>>>
>>>>>> Pinaki Poddar
>>>>>> BEA Systems
>>>>>> 415.402.7317
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Michael Dick [mailto:michael.d.dick@gmail.com]
>>>>>> Sent: Friday, February 23, 2007 11:44 AM
>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>> Subject: Re: Test failure @ svn revision 511041
>>>>>>
>>>>>> The tests passed for me this morning on one of my systems, but
>>>> I'll
>>>>>> run again to make sure.
>>>>>>
>>>>>> FWIW, I am having the NPE problem with the tests on a different
>>>>>> system
>>>>>
>>>>>> On that system I set the OpenJPA logging level to ERROR
>> instead of
>>>>>> INFO and the tests passed.  I'm guessing it's a hokey timing /
>>>>>> filesystem thing, but I haven't had time to look at it too much.
>>>>>>
>>>>>> The tests just completed for me with  revision 511062, I think
>>>> we're
>>>>> ok.
>>>>>>
>>>>>> -Mike
>>>>>>
>>>>>>
>>>>>> On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
>>>>>>>
>>>>>>> I haven't been able to run the persistence models test since my
>>>>>>> email of a week or so ago.
>>>>>>>
>>>>>>> -Patrick
>>>>>>>
>>>>>>> --
>>>>>>> Patrick Linskey
>>>>>>> BEA Systems, Inc.
>>>>>>>
>>>>>>>
>>>>
>> ____________________________________________________________________
>>>>>>> __
>>>>>>> _
>>>>>>> Notice:  This email message, together with any attachments, may
>>>>>>> contain information  of  BEA Systems,  Inc.,  its
>>>> subsidiaries  and
>>>>>>> affiliated entities,  that may be confidential,  proprietary,
>>>>>>> copyrighted  and/or legally privileged, and is
>> intended solely
>>>> for
>>>>>>> the
>>>>>>
>>>>>>> use of the individual or entity named in this message.
>> If you are
>>>>>>> not the intended recipient, and have received this message in
>>>> error,
>>>>>
>>>>>>> please immediately return this by email and then delete it.
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Pinaki Poddar
>>>>>>>> Sent: Friday, February 23, 2007 10:43 AM
>>>>>>>> To: open-jpa-dev@incubator.apache.org
>>>>>>>> Subject: Test failure @ svn revision 511041
>>>>>>>>
>>>>>>>> I am seeing a test failure @ revision 511041, $ mvn package
>>>>>>>>
>>>>>>>> The following test is failing:
>>>>>>>> org.apache.openjpa.persistence.models.company.propertyaccess.T
>>>>>>>> estPropert
>>>>>>>> yCompanyModel#testBasicQueries
>>>>>>>>
>>>>>>>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded
>>>>>>>> JDBC Driver 10.2.2.0 - (485682)).
>>>>>>>>
>>>>>>>> Will someone please verify that the tests are passing in their
>>>>>>>> environment?
>>>>>>>>
>>>>>>>>
>>>>>>>> Pinaki Poddar
>>>>>>>> BEA Systems
>>>>>>>> 415.402.7317
>>>>>>>>
>>>>>>>>
>>>>>>>> ______________________________________________________________
>>>>>>>> _________
>>>>>>>> Notice:  This email message, together with any
>> attachments, may
>>>>>>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
>>>>>>>> and affiliated entities,  that may be confidential,
>>>> proprietary,
>>>>>>>> copyrighted  and/or legally privileged, and is intended
>>>> solely for
>>>>>
>>>>>>>> the use of the individual or entity named in this
>> message. If
>>>> you
>>>>>>>> are not the intended recipient, and have received this
>>>> message in
>>>>>>>> error, please immediately return this by email and then
>>>> delete it.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> -Michael Dick
>>>>>>
>>>>
>> _____________________________________________________________________
>>>>>> _
>>>>>> _
>>>>>> Notice:  This email message, together with any attachments, may
>>>>>> contain information  of  BEA Systems,  Inc.,  its
>> subsidiaries
>>>> and
>>>>>> affiliated entities,  that may be confidential,  proprietary,
>>>>>> copyrighted  and/or legally privileged, and is intended
>> solely for
>>>>>> the
>>>>>
>>>>>> use of the individual or entity named in this message. If you
>>>> are not
>>>>>> the intended recipient, and have received this message in error,
>>>>>> please immediately return this by email and then delete it.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> -Michael Dick
>>>>>
>>>>
>> _____________________________________________________________________
>>>> _
>>>>> _
>>>>> Notice:  This email message, together with any attachments, may
>>>>> contain
>>>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>>>> affiliated
>>>>> entities,  that may be confidential,  proprietary,  copyrighted
>>>>> and/or
>>>>> legally privileged, and is intended solely for the use of the
>>>>> individual
>>>>> or entity named in this message. If you are not the intended
>>>>> recipient,
>>>>> and have received this message in error, please
>> immediately return
>>>>> this
>>>>> by email and then delete it.
>>>>
>>>> Craig Russell
>>>> Architect, Sun Java Enterprise System
>> http://java.sun.com/products/
>>>> jdo
>>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>>> P.S. A good JDO? O, Gasp!
>>>>
>>>>
>>>> --
>>> -Michael Dick
>>
>>


RE: Test failure @ svn revision 511041

Posted by Patrick Linskey <pl...@bea.com>.
If I remove that file and run 'mvn clean test', everything passes.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Marc Prud'hommeaux [mailto:mprudhomapache@gmail.com] On 
> Behalf Of Marc Prud'hommeaux
> Sent: Monday, February 26, 2007 3:19 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: Test failure @ svn revision 511041
> 
> All-
> 
> Sorry for the long delay in looking into this (I was on vacation). I  
> can't imagine that this is anything but a bug in Derby, since it is  
> an NPE coming from Derby code (and it is a seemingly valid SQL  
> statement that intermittently works). However, I can't get it to  
> happen (on OS X).
> 
> For those people who experience the problem, what happens if you  
> delete the TestPropertyCompanyModel.java and re-run? Does the 
> problem  
> re-appear elsewhere, or does it go away? If the latter, we 
> might just  
> remove that one test.
> 
> 
> 
> On Feb 23, 2007, at 11:34 PM, Michael Dick wrote:
> 
> > Well my logging workaround is probably due to something 
> else screwy  
> > in my
> > environment. I can get the tests to pass on two Linux boxes, but  
> > not on
> > Windows. The snapshot builds were updated yesterday morning so it  
> > looks like
> > the continuum servers are working.
> >
> > Sorry for the false alarm earlier. Nothing to see here, 
> move along :-)
> >
> > On 2/23/07, Craig L Russell <Cr...@sun.com> wrote:
> >>
> >> I still get failures on the checked-out HEAD.
> >>
> >> Updated to revision 511104.
> >> %mvn install
> >> [INFO] Scanning for projects...
> >> [INFO] Reactor build order:
> >> [INFO]   OpenJPA
> >> [INFO]   OpenJPA Utilities
> >> [INFO]   OpenJPA Kernel
> >> [INFO]   OpenJPA JDBC
> >> [INFO]   OpenJPA XML Store
> >> [INFO]   OpenJPA JDBC 1.5
> >> [INFO]   OpenJPA Kernel 1.5
> >> [INFO]   OpenJPA JPA
> >> [INFO]   OpenJPA JPA JDBC
> >> [INFO]   OpenJPA Aggregate Jar
> >> [INFO]   OpenJPA Persistence Examples
> >> [INFO]   OpenJPA Distribution
> >> [INFO]   OpenJPA Integration Tests
> >> [INFO]   OpenJPA Examples Integration Tests
> >> [INFO]   OpenJPA JPA TCK Integration Tests
> >> ...
> >>
> >> Running
> >> 
> org.apache.openjpa.persistence.models.company.propertyaccess.TestProp 
> >> ert
> >> yCompanyModel
> >> 1  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.0.0
> >> 10  test  INFO   [main] openjpa.jdbc.JDBC - OpenJPA will 
> now connect
> >> to the database to attempt to determine what type of database
> >> dictionary to use.  To prevent this connection in the future, set
> >> your openjpa.jdbc.DBDictionary configuration property to the
> >> appropriate value for your database (see the documentation for
> >> available values).
> >> 16  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
> >> "org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache 
> Derby 10.2.2.0
> >> - (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
> >> 22  test  INFO   [main] openjpa.MetaData - Found 10 classes with
> >> metadata in 1 milliseconds.
> >> 30  test  INFO   [main] openjpa.MetaData - Found 10 classes with
> >> metadata in 1 milliseconds.
> >> 31  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim 
> >> eEm
> >> ployee".
> >> 32  test  INFO   [main] openjpa.MetaData - Parsing package
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim 
> >> eEm
> >> ployee".
> >> 43  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Employe 
> >> e".
> >> 51  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Person" 
> >> .
> >> 58  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Address 
> >> ".
> >> 68  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Company 
> >> ".
> >> 140  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
> >> ".
> >> 156  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.LineIte 
> >> m".
> >> 164  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Custome 
> >> r".
> >> 172  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
> >> Ord
> >> er".
> >> 183  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTim 
> >> eEm
> >> ployee".
> >> 219  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name "PRP_Address".
> >> 227  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name "PRP_Company".
> >> 235  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name "PRP_LineItem".
> >> 313  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name "PRP_Person".
> >> 324  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name "PRP_Product".
> >> 369  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name "PRP_ProductOrder".
> >> 378  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name
> >> "PRP_ProductOrder_PRP_LineItem".
> >> 385  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> >> information for schema name "null", table name
> >> "PRP_Product_PRP_Company".
> >> 446  test  INFO   [main] openjpa.jdbc.Schema - Reading sequence
> >> information for schema "null", sequence name "null".
> >> 480  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Company 
> >> ".
> >> 482  test  INFO   [main] openjpa.MetaData - Parsing package
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Company 
> >> ".
> >> 512  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Address 
> >> ".
> >> 518  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Employe 
> >> e".
> >> 524  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Person" 
> >> .
> >> 533  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
> >> ".
> >> 540  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim 
> >> eEm
> >> ployee".
> >> 722  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
> >> Ord
> >> er".
> >> 733  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.Custome 
> >> r".
> >> 740  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.LineIte 
> >> m".
> >> 873  test  INFO   [main] openjpa.MetaData - Parsing class
> >> 
> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTim 
> >> eEm
> >> ployee".
> >> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> >> 63.348 sec <<< FAILURE!
> >> testBasicQueries
> >> 
> (org.apache.openjpa.persistence.models.company.propertyaccess.TestPro 
> >> per
> >> tyCompanyModel)  Time elapsed: 63.322 sec  <<< ERROR!
> >> <0|false|0.0.0> 
> org.apache.openjpa.persistence.PersistenceException:
> >> The exception 'java.lang.NullPointerException' was thrown while
> >> evaluating an expression. {prepstmnt 6533344 SELECT t0.id, 
> t0.DTYPE,
> >> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
> >> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
> >> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
> >> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
> >> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
> >> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM 
> PRP_Person t0 LEFT
> >> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
> >> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
> >> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
> >> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST 
> >> (ABS
> >> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
> >> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
> >> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS 
> VARCHAR(1000)))
> >> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
> >> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
> >> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS 
> BIGINT) OR
> >> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR 
> CAST(((LOCATE
> >> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
> >> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) 
> + 1) - 1)
> >> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
> >> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
> >> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 
> 1) - 1) + ?)
> >> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
> >> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? 
> AS BIGINT)
> >> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS 
> BIGINT) > CAST(?
> >> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = 
> ? OR LOWER
> >> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
> >> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) 
> <> CAST(?
> >> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS 
> DOUBLE) OR
> >> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
> >> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + 
> (CAST(? AS
> >> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? 
> AS BIGINT)
> >> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
> >> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS 
> BIGINT))) AS
> >> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS 
> BIGINT)))) AS
> >> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
> >> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST 
> >> (((CAST
> >> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, 
> CAST(((? + (CAST
> >> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
> >> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR 
> LTRIM(t1.firstName)
> >> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
> >> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
> >> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS 
> VARCHAR(1000))) = ? OR
> >> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
> >> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
> >> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
> >> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
> >> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
> >> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
> >> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id 
> IS NOT NULL
> >> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR 
> t1.lastName IS
> >> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
> >> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
> >> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS 
> REAL) OR CAST
> >> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
> >> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
> >> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS 
> NOT NULL OR
> >> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 
> 0, (long)
> >> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0, 
> (long) 0,
> >> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) 
> x, (long)
> >> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
> >> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0, 
> (long) 0,
> >> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
> >> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 
> 1, (long) 1,
> >> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 
> 1, (int) 1,
> >> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
> >> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
> >> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 
> 0, (long) 0,
> >> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
> >> (String) PartTimeEmployee]} [code=30000, state=38000]
> >>          at  
> >> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException
> >> (DBDictionary.java:3780)
> >>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
> >> (SQLExceptions.java:94)
> >>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
> >> (SQLExceptions.java:80)
> >>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
> >> (SQLExceptions.java:56)
> >>          at
> >> 
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheck 
> >> edE
> >> xception(SelectResultObjectProvider.java:152)
> >>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> >> (EagerResultList.java:37)
> >>          at org.apache.openjpa.kernel.QueryImpl.toResult
> >> (QueryImpl.java:1214)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:981)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:791)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:761)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:757)
> >>          at org.apache.openjpa.kernel.DelegatingQuery.execute
> >> (DelegatingQuery.java:512)
> >>          at org.apache.openjpa.persistence.QueryImpl.execute
> >> (QueryImpl.java:225)
> >>          at org.apache.openjpa.persistence.QueryImpl.getResultList
> >> (QueryImpl.java:264)
> >>          at org.apache.openjpa.persistence.test.SingleEMTest.find
> >> (SingleEMTest.java:250)
> >>          at
> >> 
> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa 
> >> sic
> >> Queries(CompanyModelTest.java:99)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at junit.framework.TestCase.runTest(TestCase.java:154)
> >>          at junit.framework.TestCase.runBare(TestCase.java:127)
> >>          at 
> junit.framework.TestResult$1.protect(TestResult.java:106)
> >>          at junit.framework.TestResult.runProtected 
> >> (TestResult.java:124)
> >>          at junit.framework.TestResult.run(TestResult.java:109)
> >>          at junit.framework.TestCase.run(TestCase.java:118)
> >>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>          at junit.framework.TestSuite.run(TestSuite.java:203)
> >>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown  
> >> Source)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
> >> (JUnitTestSet.java:210)
> >>          at
> >> 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes 
> >> tSe
> >> t(AbstractDirectoryTestSuite.java:135)
> >>          at
> >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> >> (AbstractDirectoryTestSuite.java:122)
> >>          at 
> org.apache.maven.surefire.Surefire.run(Surefire.java:129)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at
> >> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> >> (SurefireBooter.java:225)
> >>          at org.apache.maven.surefire.booter.SurefireBooter.main
> >> (SurefireBooter.java:747)
> >> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The
> >> exception 'java.lang.NullPointerException' was thrown while
> >> evaluating an expression. {prepstmnt 6533344 SELECT t0.id, 
> t0.DTYPE,
> >> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
> >> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
> >> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
> >> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
> >> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
> >> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM 
> PRP_Person t0 LEFT
> >> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
> >> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
> >> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
> >> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST 
> >> (ABS
> >> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
> >> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
> >> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS 
> VARCHAR(1000)))
> >> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
> >> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
> >> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS 
> BIGINT) OR
> >> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR 
> CAST(((LOCATE
> >> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
> >> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) 
> + 1) - 1)
> >> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
> >> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
> >> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 
> 1) - 1) + ?)
> >> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
> >> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? 
> AS BIGINT)
> >> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS 
> BIGINT) > CAST(?
> >> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = 
> ? OR LOWER
> >> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
> >> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) 
> <> CAST(?
> >> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS 
> DOUBLE) OR
> >> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
> >> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + 
> (CAST(? AS
> >> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? 
> AS BIGINT)
> >> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
> >> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS 
> BIGINT))) AS
> >> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS 
> BIGINT)))) AS
> >> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
> >> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST 
> >> (((CAST
> >> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, 
> CAST(((? + (CAST
> >> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
> >> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR 
> LTRIM(t1.firstName)
> >> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
> >> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
> >> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS 
> VARCHAR(1000))) = ? OR
> >> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
> >> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
> >> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
> >> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
> >> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
> >> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
> >> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id 
> IS NOT NULL
> >> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR 
> t1.lastName IS
> >> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
> >> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
> >> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS 
> REAL) OR CAST
> >> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
> >> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
> >> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS 
> NOT NULL OR
> >> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 
> 0, (long)
> >> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0, 
> (long) 0,
> >> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) 
> x, (long)
> >> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
> >> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0, 
> (long) 0,
> >> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
> >> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 
> 1, (long) 1,
> >> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 
> 1, (int) 1,
> >> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
> >> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
> >> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 
> 0, (long) 0,
> >> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
> >> (String) PartTimeEmployee]} [code=30000, state=38000]
> >>          at
> >> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap
> >> (LoggingConnectionDecorator.java:188)
> >>          at
> >> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800
> >> (LoggingConnectionDecorator.java:53)
> >>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
> >> $LoggingConnection$LoggingPreparedStatement.executeQuery
> >> (LoggingConnectionDecorator.java:840)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:259)
> >>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
> >> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:249)
> >>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> >> (SelectImpl.java:324)
> >>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> >> (SelectImpl.java:296)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion
> >> $UnionSelect.execute(LogicalUnion.java:402)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> >> (LogicalUnion.java:213)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> >> (LogicalUnion.java:203)
> >>          at
> >> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
> >> (SelectResultObjectProvider.java:91)
> >>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> >> (EagerResultList.java:31)
> >>          ... 35 more
> >> NestedThrowables:
> >> ERROR 38000: The exception 'java.lang.NullPointerException' was
> >> thrown while evaluating an expression.
> >>          at  
> >> org.apache.derby.iapi.error.StandardException.newException
> >> (Unknown Source)
> >>          at
> >> 
> org.apache.derby.iapi.error.StandardException.unexpectedUserException
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
> >> Source)
> >>          at
> >> 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow 
> >> Cor
> >> e(Unknown Source)
> >>          at 
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> >> (Unknown Source)
> >>          at 
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> >> (Unknown Source)
> >>          at 
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
> >> (Unknown Source)
> >>          at  
> >> org.apache.derby.impl.sql.GenericPreparedStatement.execute
> >> (Unknown Source)
> >>          at  
> >> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
> >> (Unknown Source)
> >>          at
> >> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:92)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:261)
> >>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
> >> $LoggingConnection$LoggingPreparedStatement.executeQuery
> >> (LoggingConnectionDecorator.java:838)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:259)
> >>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
> >> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:249)
> >>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> >> (SelectImpl.java:324)
> >>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> >> (SelectImpl.java:296)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion
> >> $UnionSelect.execute(LogicalUnion.java:402)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> >> (LogicalUnion.java:213)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> >> (LogicalUnion.java:203)
> >>          at
> >> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
> >> (SelectResultObjectProvider.java:91)
> >>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> >> (EagerResultList.java:31)
> >>          at org.apache.openjpa.kernel.QueryImpl.toResult
> >> (QueryImpl.java:1214)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:981)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:791)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:761)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:757)
> >>          at org.apache.openjpa.kernel.DelegatingQuery.execute
> >> (DelegatingQuery.java:512)
> >>          at org.apache.openjpa.persistence.QueryImpl.execute
> >> (QueryImpl.java:225)
> >>          at org.apache.openjpa.persistence.QueryImpl.getResultList
> >> (QueryImpl.java:264)
> >>          at org.apache.openjpa.persistence.test.SingleEMTest.find
> >> (SingleEMTest.java:250)
> >>          at
> >> 
> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa 
> >> sic
> >> Queries(CompanyModelTest.java:99)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at junit.framework.TestCase.runTest(TestCase.java:154)
> >>          at junit.framework.TestCase.runBare(TestCase.java:127)
> >>          at 
> junit.framework.TestResult$1.protect(TestResult.java:106)
> >>          at junit.framework.TestResult.runProtected 
> >> (TestResult.java:124)
> >>          at junit.framework.TestResult.run(TestResult.java:109)
> >>          at junit.framework.TestCase.run(TestCase.java:118)
> >>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>          at junit.framework.TestSuite.run(TestSuite.java:203)
> >>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown  
> >> Source)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
> >> (JUnitTestSet.java:210)
> >>          at
> >> 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes 
> >> tSe
> >> t(AbstractDirectoryTestSuite.java:135)
> >>          at
> >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> >> (AbstractDirectoryTestSuite.java:122)
> >>          at 
> org.apache.maven.surefire.Surefire.run(Surefire.java:129)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at
> >> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> >> (SurefireBooter.java:225)
> >>          at org.apache.maven.surefire.booter.SurefireBooter.main
> >> (SurefireBooter.java:747)
> >> java.lang.NullPointerException
> >>          at
> >> org.apache.derby.exe.ac80a29d05x0110xf079xcde5x0000000b87880.e11
> >> (Unknown Source)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at
> >> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
> >> Source)
> >>          at
> >> 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow 
> >> Cor
> >> e(Unknown Source)
> >>          at 
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> >> (Unknown Source)
> >>          at 
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> >> (Unknown Source)
> >>          at 
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
> >> (Unknown Source)
> >>          at  
> >> org.apache.derby.impl.sql.GenericPreparedStatement.execute
> >> (Unknown Source)
> >>          at  
> >> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
> >> (Unknown Source)
> >>          at
> >> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
> >> (Unknown Source)
> >>          at
> >> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:92)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:261)
> >>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
> >> $LoggingConnection$LoggingPreparedStatement.executeQuery
> >> (LoggingConnectionDecorator.java:838)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:259)
> >>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
> >> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
> >>          at
> >> 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> >> (DelegatingPreparedStatement.java:249)
> >>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> >> (SelectImpl.java:324)
> >>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> >> (SelectImpl.java:296)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion
> >> $UnionSelect.execute(LogicalUnion.java:402)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> >> (LogicalUnion.java:213)
> >>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> >> (LogicalUnion.java:203)
> >>          at
> >> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
> >> (SelectResultObjectProvider.java:91)
> >>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> >> (EagerResultList.java:31)
> >>          at org.apache.openjpa.kernel.QueryImpl.toResult
> >> (QueryImpl.java:1214)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:981)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:791)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:761)
> >>          at org.apache.openjpa.kernel.QueryImpl.execute
> >> (QueryImpl.java:757)
> >>          at org.apache.openjpa.kernel.DelegatingQuery.execute
> >> (DelegatingQuery.java:512)
> >>          at org.apache.openjpa.persistence.QueryImpl.execute
> >> (QueryImpl.java:225)
> >>          at org.apache.openjpa.persistence.QueryImpl.getResultList
> >> (QueryImpl.java:264)
> >>          at org.apache.openjpa.persistence.test.SingleEMTest.find
> >> (SingleEMTest.java:250)
> >>          at
> >> 
> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa 
> >> sic
> >> Queries(CompanyModelTest.java:99)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at junit.framework.TestCase.runTest(TestCase.java:154)
> >>          at junit.framework.TestCase.runBare(TestCase.java:127)
> >>          at 
> junit.framework.TestResult$1.protect(TestResult.java:106)
> >>          at junit.framework.TestResult.runProtected 
> >> (TestResult.java:124)
> >>          at junit.framework.TestResult.run(TestResult.java:109)
> >>          at junit.framework.TestCase.run(TestCase.java:118)
> >>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>          at junit.framework.TestSuite.run(TestSuite.java:203)
> >>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown  
> >> Source)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
> >> (JUnitTestSet.java:210)
> >>          at
> >> 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes 
> >> tSe
> >> t(AbstractDirectoryTestSuite.java:135)
> >>          at
> >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> >> (AbstractDirectoryTestSuite.java:122)
> >>          at 
> org.apache.maven.surefire.Surefire.run(Surefire.java:129)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >>          at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>          at java.lang.reflect.Method.invoke(Method.java:585)
> >>          at
> >> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> >> (SurefireBooter.java:225)
> >>          at org.apache.maven.surefire.booter.SurefireBooter.main
> >> (SurefireBooter.java:747)
> >> ...
> >> Results :
> >> Tests run: 76, Failures: 0, Errors: 1, Skipped: 0
> >>
> >>
> >> On Feb 23, 2007, at 12:20 PM, Pinaki Poddar wrote:
> >>
> >> >> I should have the same code as you. Did you try changing the log
> >> > level?
> >> > Yes I too am  at
> >> > $svnversion -c
> >> > 406193:511043
> >> >
> >> > Changing log level to error in 
> openjpa-persistence-jdbc/pom.xml did
> >> > not
> >> > impact the test failure.
> >> >
> >> >
> >> > Pinaki Poddar
> >> > BEA Systems
> >> > 415.402.7317
> >> >
> >> >
> >> > -----Original Message-----
> >> > From: Michael Dick [mailto:michael.d.dick@gmail.com]
> >> > Sent: Friday, February 23, 2007 11:58 AM
> >> > To: open-jpa-dev@incubator.apache.org
> >> > Subject: Re: Test failure @ svn revision 511041
> >> >
> >> > I think so, that's what's specified in pom.xml (except for
> >> > openjpa-integration) and it should be picked up from there.
> >> >
> >> > Log entries like this show up when I run the tests :
> >> > 17  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary  
> >> class "
> >> > org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby  
> >> 10.2.2.0 -
> >> > (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
> >> >
> >> > Svnversion -c gives me this output :
> >> > mikedd@tessier:~/work/jpa/openjpa$ svnversion -c
> >> > 406193:511043
> >> >
> >> > I should have the same code as you. Did you try changing the log
> >> > level?
> >> >
> >> > On 2/23/07, Pinaki Poddar <pp...@bea.com> wrote:
> >> >>
> >> >> The stacktrace points that it *may* be a driver issue (the  
> >> error is
> >> >> NPE with Derby driver and not an SQLException)
> >> >> java.lang.NullPointerException
> >> >>         at
> >> >> org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11
> >> >> (Unkno
> >> >> wn
> >> >> Source)
> >> >>
> >> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
> >> Method)
> >> >>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> >> >> Source)
> >> >>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> >> >> Source)
> >> >>         at java.lang.reflect.Method.invoke(Unknown Source)
> >> >>         at
> >> >> org.apache.derby.impl.services.reflect.ReflectMethod.invoke 
> >> (Unknown
> >> >> Source)
> >> >>         at
> >> >>  
> >> 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow
> >> >> C
> >> >> or
> >> >> e(Unknown Source)
> >> >>         at
> >> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> >> > Source)
> >> >>         at
> >> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> >> > Source)
> >> >>         at
> >> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> >> > Source)
> >> >>         at
> >> >>  
> >> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
> >> >> (Un
> >> >> kn
> >> >> own Source)
> >> >>         at
> >> >> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
> >> >> (Unknown
> >> >> Source)
> >> >>         at
> >> >> 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
> >> >> Source)
> >> >>         at
> >> >> 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> >> >> Source)
> >> >>         at
> >> >> 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
> >> >> (Unk
> >> >> no
> >> >> wn Source)
> >> >>
> >> >>
> >> >> Are you using the same driver?
> >> >>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby 
> Embedded  
> >> JDBC
> >> >
> >> >>> Driver 10.2.2.0 - (485682)).
> >> >>
> >> >>
> >> >> Pinaki Poddar
> >> >> BEA Systems
> >> >> 415.402.7317
> >> >>
> >> >>
> >> >> -----Original Message-----
> >> >> From: Michael Dick [mailto:michael.d.dick@gmail.com]
> >> >> Sent: Friday, February 23, 2007 11:44 AM
> >> >> To: open-jpa-dev@incubator.apache.org
> >> >> Subject: Re: Test failure @ svn revision 511041
> >> >>
> >> >> The tests passed for me this morning on one of my systems, but  
> >> I'll
> >> >> run again to make sure.
> >> >>
> >> >> FWIW, I am having the NPE problem with the tests on a different
> >> >> system
> >> >
> >> >> On that system I set the OpenJPA logging level to ERROR 
> instead of
> >> >> INFO and the tests passed.  I'm guessing it's a hokey timing /
> >> >> filesystem thing, but I haven't had time to look at it too much.
> >> >>
> >> >> The tests just completed for me with  revision 511062, I think  
> >> we're
> >> > ok.
> >> >>
> >> >> -Mike
> >> >>
> >> >>
> >> >> On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
> >> >>>
> >> >>> I haven't been able to run the persistence models test since my
> >> >>> email of a week or so ago.
> >> >>>
> >> >>> -Patrick
> >> >>>
> >> >>> --
> >> >>> Patrick Linskey
> >> >>> BEA Systems, Inc.
> >> >>>
> >> >>>  
> >> 
> ____________________________________________________________________
> >> >>> __
> >> >>> _
> >> >>> Notice:  This email message, together with any attachments, may
> >> >>> contain information  of  BEA Systems,  Inc.,  its  
> >> subsidiaries  and
> >> >>> affiliated entities,  that may be confidential,  proprietary,
> >> >>> copyrighted  and/or legally privileged, and is 
> intended solely  
> >> for
> >> >>> the
> >> >>
> >> >>> use of the individual or entity named in this message. 
> If you are
> >> >>> not the intended recipient, and have received this message in  
> >> error,
> >> >
> >> >>> please immediately return this by email and then delete it.
> >> >>>
> >> >>>> -----Original Message-----
> >> >>>> From: Pinaki Poddar
> >> >>>> Sent: Friday, February 23, 2007 10:43 AM
> >> >>>> To: open-jpa-dev@incubator.apache.org
> >> >>>> Subject: Test failure @ svn revision 511041
> >> >>>>
> >> >>>> I am seeing a test failure @ revision 511041, $ mvn package
> >> >>>>
> >> >>>> The following test is failing:
> >> >>>> org.apache.openjpa.persistence.models.company.propertyaccess.T
> >> >>>> estPropert
> >> >>>> yCompanyModel#testBasicQueries
> >> >>>>
> >> >>>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded
> >> >>>> JDBC Driver 10.2.2.0 - (485682)).
> >> >>>>
> >> >>>> Will someone please verify that the tests are passing in their
> >> >>>> environment?
> >> >>>>
> >> >>>>
> >> >>>> Pinaki Poddar
> >> >>>> BEA Systems
> >> >>>> 415.402.7317
> >> >>>>
> >> >>>>
> >> >>>> ______________________________________________________________
> >> >>>> _________
> >> >>>> Notice:  This email message, together with any 
> attachments, may
> >> >>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
> >> >>>> and affiliated entities,  that may be confidential,   
> >> proprietary,
> >> >>>> copyrighted  and/or legally privileged, and is intended  
> >> solely for
> >> >
> >> >>>> the use of the individual or entity named in this 
> message. If  
> >> you
> >> >>>> are not the intended recipient, and have received this  
> >> message in
> >> >>>> error, please immediately return this by email and then  
> >> delete it.
> >> >>>>
> >> >>>>
> >> >>>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> -Michael Dick
> >> >>  
> >> 
> _____________________________________________________________________
> >> >> _
> >> >> _
> >> >> Notice:  This email message, together with any attachments, may
> >> >> contain information  of  BEA Systems,  Inc.,  its 
> subsidiaries   
> >> and
> >> >> affiliated entities,  that may be confidential,  proprietary,
> >> >> copyrighted  and/or legally privileged, and is intended 
> solely for
> >> >> the
> >> >
> >> >> use of the individual or entity named in this message. If you  
> >> are not
> >> >> the intended recipient, and have received this message in error,
> >> >> please immediately return this by email and then delete it.
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > -Michael Dick
> >> >  
> >> 
> _____________________________________________________________________ 
> >> _
> >> > _
> >> > Notice:  This email message, together with any attachments, may
> >> > contain
> >> > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >> > affiliated
> >> > entities,  that may be confidential,  proprietary,  copyrighted
> >> > and/or
> >> > legally privileged, and is intended solely for the use of the
> >> > individual
> >> > or entity named in this message. If you are not the intended
> >> > recipient,
> >> > and have received this message in error, please 
> immediately return
> >> > this
> >> > by email and then delete it.
> >>
> >> Craig Russell
> >> Architect, Sun Java Enterprise System 
> http://java.sun.com/products/ 
> >> jdo
> >> 408 276-5638 mailto:Craig.Russell@sun.com
> >> P.S. A good JDO? O, Gasp!
> >>
> >>
> >> --
> > -Michael Dick
> 
> 

Re: Test failure @ svn revision 511041

Posted by Marc Prud'hommeaux <mp...@apache.org>.
All-

Sorry for the long delay in looking into this (I was on vacation). I  
can't imagine that this is anything but a bug in Derby, since it is  
an NPE coming from Derby code (and it is a seemingly valid SQL  
statement that intermittently works). However, I can't get it to  
happen (on OS X).

For those people who experience the problem, what happens if you  
delete the TestPropertyCompanyModel.java and re-run? Does the problem  
re-appear elsewhere, or does it go away? If the latter, we might just  
remove that one test.



On Feb 23, 2007, at 11:34 PM, Michael Dick wrote:

> Well my logging workaround is probably due to something else screwy  
> in my
> environment. I can get the tests to pass on two Linux boxes, but  
> not on
> Windows. The snapshot builds were updated yesterday morning so it  
> looks like
> the continuum servers are working.
>
> Sorry for the false alarm earlier. Nothing to see here, move along :-)
>
> On 2/23/07, Craig L Russell <Cr...@sun.com> wrote:
>>
>> I still get failures on the checked-out HEAD.
>>
>> Updated to revision 511104.
>> %mvn install
>> [INFO] Scanning for projects...
>> [INFO] Reactor build order:
>> [INFO]   OpenJPA
>> [INFO]   OpenJPA Utilities
>> [INFO]   OpenJPA Kernel
>> [INFO]   OpenJPA JDBC
>> [INFO]   OpenJPA XML Store
>> [INFO]   OpenJPA JDBC 1.5
>> [INFO]   OpenJPA Kernel 1.5
>> [INFO]   OpenJPA JPA
>> [INFO]   OpenJPA JPA JDBC
>> [INFO]   OpenJPA Aggregate Jar
>> [INFO]   OpenJPA Persistence Examples
>> [INFO]   OpenJPA Distribution
>> [INFO]   OpenJPA Integration Tests
>> [INFO]   OpenJPA Examples Integration Tests
>> [INFO]   OpenJPA JPA TCK Integration Tests
>> ...
>>
>> Running
>> org.apache.openjpa.persistence.models.company.propertyaccess.TestProp 
>> ert
>> yCompanyModel
>> 1  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.0.0
>> 10  test  INFO   [main] openjpa.jdbc.JDBC - OpenJPA will now connect
>> to the database to attempt to determine what type of database
>> dictionary to use.  To prevent this connection in the future, set
>> your openjpa.jdbc.DBDictionary configuration property to the
>> appropriate value for your database (see the documentation for
>> available values).
>> 16  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
>> "org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0
>> - (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
>> 22  test  INFO   [main] openjpa.MetaData - Found 10 classes with
>> metadata in 1 milliseconds.
>> 30  test  INFO   [main] openjpa.MetaData - Found 10 classes with
>> metadata in 1 milliseconds.
>> 31  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim 
>> eEm
>> ployee".
>> 32  test  INFO   [main] openjpa.MetaData - Parsing package
>> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim 
>> eEm
>> ployee".
>> 43  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Employe 
>> e".
>> 51  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Person" 
>> .
>> 58  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Address 
>> ".
>> 68  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Company 
>> ".
>> 140  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
>> ".
>> 156  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.LineIte 
>> m".
>> 164  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Custome 
>> r".
>> 172  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
>> Ord
>> er".
>> 183  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTim 
>> eEm
>> ployee".
>> 219  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name "PRP_Address".
>> 227  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name "PRP_Company".
>> 235  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name "PRP_LineItem".
>> 313  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name "PRP_Person".
>> 324  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name "PRP_Product".
>> 369  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name "PRP_ProductOrder".
>> 378  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name
>> "PRP_ProductOrder_PRP_LineItem".
>> 385  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for schema name "null", table name
>> "PRP_Product_PRP_Company".
>> 446  test  INFO   [main] openjpa.jdbc.Schema - Reading sequence
>> information for schema "null", sequence name "null".
>> 480  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Company 
>> ".
>> 482  test  INFO   [main] openjpa.MetaData - Parsing package
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Company 
>> ".
>> 512  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Address 
>> ".
>> 518  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Employe 
>> e".
>> 524  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Person" 
>> .
>> 533  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
>> ".
>> 540  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTim 
>> eEm
>> ployee".
>> 722  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Product 
>> Ord
>> er".
>> 733  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.Custome 
>> r".
>> 740  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.LineIte 
>> m".
>> 873  test  INFO   [main] openjpa.MetaData - Parsing class
>> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTim 
>> eEm
>> ployee".
>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
>> 63.348 sec <<< FAILURE!
>> testBasicQueries
>> (org.apache.openjpa.persistence.models.company.propertyaccess.TestPro 
>> per
>> tyCompanyModel)  Time elapsed: 63.322 sec  <<< ERROR!
>> <0|false|0.0.0> org.apache.openjpa.persistence.PersistenceException:
>> The exception 'java.lang.NullPointerException' was thrown while
>> evaluating an expression. {prepstmnt 6533344 SELECT t0.id, t0.DTYPE,
>> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
>> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
>> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
>> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
>> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
>> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM PRP_Person t0 LEFT
>> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
>> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
>> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
>> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST 
>> (ABS
>> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
>> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
>> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS VARCHAR(1000)))
>> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
>> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
>> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS BIGINT) OR
>> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE
>> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
>> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1)
>> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
>> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
>> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?)
>> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
>> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT)
>> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS BIGINT) > CAST(?
>> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = ? OR LOWER
>> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
>> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) <> CAST(?
>> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS DOUBLE) OR
>> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST(? AS
>> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS BIGINT)
>> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
>> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
>> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS BIGINT)))) AS
>> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
>> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST 
>> (((CAST
>> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST
>> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR LTRIM(t1.firstName)
>> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
>> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
>> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS VARCHAR(1000))) = ? OR
>> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
>> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
>> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
>> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
>> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
>> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
>> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id IS NOT NULL
>> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR t1.lastName IS
>> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
>> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS REAL) OR CAST
>> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
>> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS NOT NULL OR
>> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 0, (long)
>> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
>> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) x, (long)
>> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
>> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,
>> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
>> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1,
>> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1,
>> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
>> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
>> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0,
>> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
>> (String) PartTimeEmployee]} [code=30000, state=38000]
>>          at  
>> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException
>> (DBDictionary.java:3780)
>>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
>> (SQLExceptions.java:94)
>>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
>> (SQLExceptions.java:80)
>>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
>> (SQLExceptions.java:56)
>>          at
>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheck 
>> edE
>> xception(SelectResultObjectProvider.java:152)
>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>> (EagerResultList.java:37)
>>          at org.apache.openjpa.kernel.QueryImpl.toResult
>> (QueryImpl.java:1214)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:981)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:791)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:761)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:757)
>>          at org.apache.openjpa.kernel.DelegatingQuery.execute
>> (DelegatingQuery.java:512)
>>          at org.apache.openjpa.persistence.QueryImpl.execute
>> (QueryImpl.java:225)
>>          at org.apache.openjpa.persistence.QueryImpl.getResultList
>> (QueryImpl.java:264)
>>          at org.apache.openjpa.persistence.test.SingleEMTest.find
>> (SingleEMTest.java:250)
>>          at
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa 
>> sic
>> Queries(CompanyModelTest.java:99)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at junit.framework.TestCase.runTest(TestCase.java:154)
>>          at junit.framework.TestCase.runBare(TestCase.java:127)
>>          at junit.framework.TestResult$1.protect(TestResult.java:106)
>>          at junit.framework.TestResult.runProtected 
>> (TestResult.java:124)
>>          at junit.framework.TestResult.run(TestResult.java:109)
>>          at junit.framework.TestCase.run(TestCase.java:118)
>>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>          at junit.framework.TestSuite.run(TestSuite.java:203)
>>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown  
>> Source)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
>> (JUnitTestSet.java:210)
>>          at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes 
>> tSe
>> t(AbstractDirectoryTestSuite.java:135)
>>          at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
>> (AbstractDirectoryTestSuite.java:122)
>>          at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
>> (SurefireBooter.java:225)
>>          at org.apache.maven.surefire.booter.SurefireBooter.main
>> (SurefireBooter.java:747)
>> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The
>> exception 'java.lang.NullPointerException' was thrown while
>> evaluating an expression. {prepstmnt 6533344 SELECT t0.id, t0.DTYPE,
>> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
>> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
>> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
>> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
>> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
>> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM PRP_Person t0 LEFT
>> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
>> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
>> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
>> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST 
>> (ABS
>> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
>> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
>> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS VARCHAR(1000)))
>> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
>> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
>> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS BIGINT) OR
>> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE
>> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
>> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1)
>> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
>> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
>> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?)
>> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
>> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT)
>> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS BIGINT) > CAST(?
>> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = ? OR LOWER
>> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
>> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) <> CAST(?
>> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS DOUBLE) OR
>> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST(? AS
>> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS BIGINT)
>> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
>> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
>> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS BIGINT)))) AS
>> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
>> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST 
>> (((CAST
>> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST
>> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
>> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR LTRIM(t1.firstName)
>> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
>> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
>> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS VARCHAR(1000))) = ? OR
>> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
>> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
>> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
>> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
>> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
>> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
>> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id IS NOT NULL
>> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR t1.lastName IS
>> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
>> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS REAL) OR CAST
>> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
>> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
>> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS NOT NULL OR
>> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 0, (long)
>> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
>> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) x, (long)
>> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
>> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,
>> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
>> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1,
>> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1,
>> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
>> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
>> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0,
>> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
>> (String) PartTimeEmployee]} [code=30000, state=38000]
>>          at
>> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap
>> (LoggingConnectionDecorator.java:188)
>>          at
>> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800
>> (LoggingConnectionDecorator.java:53)
>>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
>> $LoggingConnection$LoggingPreparedStatement.executeQuery
>> (LoggingConnectionDecorator.java:840)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:259)
>>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
>> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:249)
>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>> (SelectImpl.java:324)
>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>> (SelectImpl.java:296)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion
>> $UnionSelect.execute(LogicalUnion.java:402)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>> (LogicalUnion.java:213)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>> (LogicalUnion.java:203)
>>          at
>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
>> (SelectResultObjectProvider.java:91)
>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>> (EagerResultList.java:31)
>>          ... 35 more
>> NestedThrowables:
>> ERROR 38000: The exception 'java.lang.NullPointerException' was
>> thrown while evaluating an expression.
>>          at  
>> org.apache.derby.iapi.error.StandardException.newException
>> (Unknown Source)
>>          at
>> org.apache.derby.iapi.error.StandardException.unexpectedUserException
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
>> Source)
>>          at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow 
>> Cor
>> e(Unknown Source)
>>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>> (Unknown Source)
>>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>> (Unknown Source)
>>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
>> (Unknown Source)
>>          at  
>> org.apache.derby.impl.sql.GenericPreparedStatement.execute
>> (Unknown Source)
>>          at  
>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
>> (Unknown Source)
>>          at
>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:92)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:261)
>>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
>> $LoggingConnection$LoggingPreparedStatement.executeQuery
>> (LoggingConnectionDecorator.java:838)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:259)
>>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
>> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:249)
>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>> (SelectImpl.java:324)
>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>> (SelectImpl.java:296)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion
>> $UnionSelect.execute(LogicalUnion.java:402)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>> (LogicalUnion.java:213)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>> (LogicalUnion.java:203)
>>          at
>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
>> (SelectResultObjectProvider.java:91)
>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>> (EagerResultList.java:31)
>>          at org.apache.openjpa.kernel.QueryImpl.toResult
>> (QueryImpl.java:1214)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:981)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:791)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:761)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:757)
>>          at org.apache.openjpa.kernel.DelegatingQuery.execute
>> (DelegatingQuery.java:512)
>>          at org.apache.openjpa.persistence.QueryImpl.execute
>> (QueryImpl.java:225)
>>          at org.apache.openjpa.persistence.QueryImpl.getResultList
>> (QueryImpl.java:264)
>>          at org.apache.openjpa.persistence.test.SingleEMTest.find
>> (SingleEMTest.java:250)
>>          at
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa 
>> sic
>> Queries(CompanyModelTest.java:99)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at junit.framework.TestCase.runTest(TestCase.java:154)
>>          at junit.framework.TestCase.runBare(TestCase.java:127)
>>          at junit.framework.TestResult$1.protect(TestResult.java:106)
>>          at junit.framework.TestResult.runProtected 
>> (TestResult.java:124)
>>          at junit.framework.TestResult.run(TestResult.java:109)
>>          at junit.framework.TestCase.run(TestCase.java:118)
>>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>          at junit.framework.TestSuite.run(TestSuite.java:203)
>>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown  
>> Source)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
>> (JUnitTestSet.java:210)
>>          at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes 
>> tSe
>> t(AbstractDirectoryTestSuite.java:135)
>>          at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
>> (AbstractDirectoryTestSuite.java:122)
>>          at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
>> (SurefireBooter.java:225)
>>          at org.apache.maven.surefire.booter.SurefireBooter.main
>> (SurefireBooter.java:747)
>> java.lang.NullPointerException
>>          at
>> org.apache.derby.exe.ac80a29d05x0110xf079xcde5x0000000b87880.e11
>> (Unknown Source)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at
>> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
>> Source)
>>          at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow 
>> Cor
>> e(Unknown Source)
>>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>> (Unknown Source)
>>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>> (Unknown Source)
>>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
>> (Unknown Source)
>>          at  
>> org.apache.derby.impl.sql.GenericPreparedStatement.execute
>> (Unknown Source)
>>          at  
>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
>> (Unknown Source)
>>          at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
>> (Unknown Source)
>>          at
>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:92)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:261)
>>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
>> $LoggingConnection$LoggingPreparedStatement.executeQuery
>> (LoggingConnectionDecorator.java:838)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:259)
>>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
>> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>>          at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
>> (DelegatingPreparedStatement.java:249)
>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>> (SelectImpl.java:324)
>>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
>> (SelectImpl.java:296)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion
>> $UnionSelect.execute(LogicalUnion.java:402)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>> (LogicalUnion.java:213)
>>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
>> (LogicalUnion.java:203)
>>          at
>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
>> (SelectResultObjectProvider.java:91)
>>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
>> (EagerResultList.java:31)
>>          at org.apache.openjpa.kernel.QueryImpl.toResult
>> (QueryImpl.java:1214)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:981)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:791)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:761)
>>          at org.apache.openjpa.kernel.QueryImpl.execute
>> (QueryImpl.java:757)
>>          at org.apache.openjpa.kernel.DelegatingQuery.execute
>> (DelegatingQuery.java:512)
>>          at org.apache.openjpa.persistence.QueryImpl.execute
>> (QueryImpl.java:225)
>>          at org.apache.openjpa.persistence.QueryImpl.getResultList
>> (QueryImpl.java:264)
>>          at org.apache.openjpa.persistence.test.SingleEMTest.find
>> (SingleEMTest.java:250)
>>          at
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBa 
>> sic
>> Queries(CompanyModelTest.java:99)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at junit.framework.TestCase.runTest(TestCase.java:154)
>>          at junit.framework.TestCase.runBare(TestCase.java:127)
>>          at junit.framework.TestResult$1.protect(TestResult.java:106)
>>          at junit.framework.TestResult.runProtected 
>> (TestResult.java:124)
>>          at junit.framework.TestResult.run(TestResult.java:109)
>>          at junit.framework.TestCase.run(TestCase.java:118)
>>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>          at junit.framework.TestSuite.run(TestSuite.java:203)
>>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown  
>> Source)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
>> (JUnitTestSet.java:210)
>>          at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes 
>> tSe
>> t(AbstractDirectoryTestSuite.java:135)
>>          at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
>> (AbstractDirectoryTestSuite.java:122)
>>          at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>          at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>          at java.lang.reflect.Method.invoke(Method.java:585)
>>          at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
>> (SurefireBooter.java:225)
>>          at org.apache.maven.surefire.booter.SurefireBooter.main
>> (SurefireBooter.java:747)
>> ...
>> Results :
>> Tests run: 76, Failures: 0, Errors: 1, Skipped: 0
>>
>>
>> On Feb 23, 2007, at 12:20 PM, Pinaki Poddar wrote:
>>
>> >> I should have the same code as you. Did you try changing the log
>> > level?
>> > Yes I too am  at
>> > $svnversion -c
>> > 406193:511043
>> >
>> > Changing log level to error in openjpa-persistence-jdbc/pom.xml did
>> > not
>> > impact the test failure.
>> >
>> >
>> > Pinaki Poddar
>> > BEA Systems
>> > 415.402.7317
>> >
>> >
>> > -----Original Message-----
>> > From: Michael Dick [mailto:michael.d.dick@gmail.com]
>> > Sent: Friday, February 23, 2007 11:58 AM
>> > To: open-jpa-dev@incubator.apache.org
>> > Subject: Re: Test failure @ svn revision 511041
>> >
>> > I think so, that's what's specified in pom.xml (except for
>> > openjpa-integration) and it should be picked up from there.
>> >
>> > Log entries like this show up when I run the tests :
>> > 17  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary  
>> class "
>> > org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby  
>> 10.2.2.0 -
>> > (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
>> >
>> > Svnversion -c gives me this output :
>> > mikedd@tessier:~/work/jpa/openjpa$ svnversion -c
>> > 406193:511043
>> >
>> > I should have the same code as you. Did you try changing the log
>> > level?
>> >
>> > On 2/23/07, Pinaki Poddar <pp...@bea.com> wrote:
>> >>
>> >> The stacktrace points that it *may* be a driver issue (the  
>> error is
>> >> NPE with Derby driver and not an SQLException)
>> >> java.lang.NullPointerException
>> >>         at
>> >> org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11
>> >> (Unkno
>> >> wn
>> >> Source)
>> >>
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>> >>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
>> >> Source)
>> >>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>> >> Source)
>> >>         at java.lang.reflect.Method.invoke(Unknown Source)
>> >>         at
>> >> org.apache.derby.impl.services.reflect.ReflectMethod.invoke 
>> (Unknown
>> >> Source)
>> >>         at
>> >>  
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow
>> >> C
>> >> or
>> >> e(Unknown Source)
>> >>         at
>> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
>> > Source)
>> >>         at
>> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
>> > Source)
>> >>         at
>> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
>> > Source)
>> >>         at
>> >>  
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
>> >> (Un
>> >> kn
>> >> own Source)
>> >>         at
>> >> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
>> >> (Unknown
>> >> Source)
>> >>         at
>> >> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
>> >> Source)
>> >>         at
>> >> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
>> >> Source)
>> >>         at
>> >> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
>> >> (Unk
>> >> no
>> >> wn Source)
>> >>
>> >>
>> >> Are you using the same driver?
>> >>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded  
>> JDBC
>> >
>> >>> Driver 10.2.2.0 - (485682)).
>> >>
>> >>
>> >> Pinaki Poddar
>> >> BEA Systems
>> >> 415.402.7317
>> >>
>> >>
>> >> -----Original Message-----
>> >> From: Michael Dick [mailto:michael.d.dick@gmail.com]
>> >> Sent: Friday, February 23, 2007 11:44 AM
>> >> To: open-jpa-dev@incubator.apache.org
>> >> Subject: Re: Test failure @ svn revision 511041
>> >>
>> >> The tests passed for me this morning on one of my systems, but  
>> I'll
>> >> run again to make sure.
>> >>
>> >> FWIW, I am having the NPE problem with the tests on a different
>> >> system
>> >
>> >> On that system I set the OpenJPA logging level to ERROR instead of
>> >> INFO and the tests passed.  I'm guessing it's a hokey timing /
>> >> filesystem thing, but I haven't had time to look at it too much.
>> >>
>> >> The tests just completed for me with  revision 511062, I think  
>> we're
>> > ok.
>> >>
>> >> -Mike
>> >>
>> >>
>> >> On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
>> >>>
>> >>> I haven't been able to run the persistence models test since my
>> >>> email of a week or so ago.
>> >>>
>> >>> -Patrick
>> >>>
>> >>> --
>> >>> Patrick Linskey
>> >>> BEA Systems, Inc.
>> >>>
>> >>>  
>> ____________________________________________________________________
>> >>> __
>> >>> _
>> >>> Notice:  This email message, together with any attachments, may
>> >>> contain information  of  BEA Systems,  Inc.,  its  
>> subsidiaries  and
>> >>> affiliated entities,  that may be confidential,  proprietary,
>> >>> copyrighted  and/or legally privileged, and is intended solely  
>> for
>> >>> the
>> >>
>> >>> use of the individual or entity named in this message. If you are
>> >>> not the intended recipient, and have received this message in  
>> error,
>> >
>> >>> please immediately return this by email and then delete it.
>> >>>
>> >>>> -----Original Message-----
>> >>>> From: Pinaki Poddar
>> >>>> Sent: Friday, February 23, 2007 10:43 AM
>> >>>> To: open-jpa-dev@incubator.apache.org
>> >>>> Subject: Test failure @ svn revision 511041
>> >>>>
>> >>>> I am seeing a test failure @ revision 511041, $ mvn package
>> >>>>
>> >>>> The following test is failing:
>> >>>> org.apache.openjpa.persistence.models.company.propertyaccess.T
>> >>>> estPropert
>> >>>> yCompanyModel#testBasicQueries
>> >>>>
>> >>>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded
>> >>>> JDBC Driver 10.2.2.0 - (485682)).
>> >>>>
>> >>>> Will someone please verify that the tests are passing in their
>> >>>> environment?
>> >>>>
>> >>>>
>> >>>> Pinaki Poddar
>> >>>> BEA Systems
>> >>>> 415.402.7317
>> >>>>
>> >>>>
>> >>>> ______________________________________________________________
>> >>>> _________
>> >>>> Notice:  This email message, together with any attachments, may
>> >>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
>> >>>> and affiliated entities,  that may be confidential,   
>> proprietary,
>> >>>> copyrighted  and/or legally privileged, and is intended  
>> solely for
>> >
>> >>>> the use of the individual or entity named in this message. If  
>> you
>> >>>> are not the intended recipient, and have received this  
>> message in
>> >>>> error, please immediately return this by email and then  
>> delete it.
>> >>>>
>> >>>>
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> -Michael Dick
>> >>  
>> _____________________________________________________________________
>> >> _
>> >> _
>> >> Notice:  This email message, together with any attachments, may
>> >> contain information  of  BEA Systems,  Inc.,  its subsidiaries   
>> and
>> >> affiliated entities,  that may be confidential,  proprietary,
>> >> copyrighted  and/or legally privileged, and is intended solely for
>> >> the
>> >
>> >> use of the individual or entity named in this message. If you  
>> are not
>> >> the intended recipient, and have received this message in error,
>> >> please immediately return this by email and then delete it.
>> >>
>> >
>> >
>> >
>> > --
>> > -Michael Dick
>> >  
>> _____________________________________________________________________ 
>> _
>> > _
>> > Notice:  This email message, together with any attachments, may
>> > contain
>> > information  of  BEA Systems,  Inc.,  its subsidiaries  and
>> > affiliated
>> > entities,  that may be confidential,  proprietary,  copyrighted
>> > and/or
>> > legally privileged, and is intended solely for the use of the
>> > individual
>> > or entity named in this message. If you are not the intended
>> > recipient,
>> > and have received this message in error, please immediately return
>> > this
>> > by email and then delete it.
>>
>> Craig Russell
>> Architect, Sun Java Enterprise System http://java.sun.com/products/ 
>> jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!
>>
>>
>> --
> -Michael Dick


Re: Test failure @ svn revision 511041

Posted by Michael Dick <mi...@gmail.com>.
Well my logging workaround is probably due to something else screwy in my
environment. I can get the tests to pass on two Linux boxes, but not on
Windows. The snapshot builds were updated yesterday morning so it looks like
the continuum servers are working.

Sorry for the false alarm earlier. Nothing to see here, move along :-)

On 2/23/07, Craig L Russell <Cr...@sun.com> wrote:
>
> I still get failures on the checked-out HEAD.
>
> Updated to revision 511104.
> %mvn install
> [INFO] Scanning for projects...
> [INFO] Reactor build order:
> [INFO]   OpenJPA
> [INFO]   OpenJPA Utilities
> [INFO]   OpenJPA Kernel
> [INFO]   OpenJPA JDBC
> [INFO]   OpenJPA XML Store
> [INFO]   OpenJPA JDBC 1.5
> [INFO]   OpenJPA Kernel 1.5
> [INFO]   OpenJPA JPA
> [INFO]   OpenJPA JPA JDBC
> [INFO]   OpenJPA Aggregate Jar
> [INFO]   OpenJPA Persistence Examples
> [INFO]   OpenJPA Distribution
> [INFO]   OpenJPA Integration Tests
> [INFO]   OpenJPA Examples Integration Tests
> [INFO]   OpenJPA JPA TCK Integration Tests
> ...
>
> Running
> org.apache.openjpa.persistence.models.company.propertyaccess.TestPropert
> yCompanyModel
> 1  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.0.0
> 10  test  INFO   [main] openjpa.jdbc.JDBC - OpenJPA will now connect
> to the database to attempt to determine what type of database
> dictionary to use.  To prevent this connection in the future, set
> your openjpa.jdbc.DBDictionary configuration property to the
> appropriate value for your database (see the documentation for
> available values).
> 16  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
> "org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0
> - (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
> 22  test  INFO   [main] openjpa.MetaData - Found 10 classes with
> metadata in 1 milliseconds.
> 30  test  INFO   [main] openjpa.MetaData - Found 10 classes with
> metadata in 1 milliseconds.
> 31  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTimeEm
> ployee".
> 32  test  INFO   [main] openjpa.MetaData - Parsing package
> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTimeEm
> ployee".
> 43  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Employee".
> 51  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Person".
> 58  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Address".
> 68  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Company".
> 140  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Product".
> 156  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.LineItem".
> 164  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Customer".
> 172  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.ProductOrd
> er".
> 183  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTimeEm
> ployee".
> 219  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name "PRP_Address".
> 227  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name "PRP_Company".
> 235  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name "PRP_LineItem".
> 313  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name "PRP_Person".
> 324  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name "PRP_Product".
> 369  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name "PRP_ProductOrder".
> 378  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name
> "PRP_ProductOrder_PRP_LineItem".
> 385  test  INFO   [main] openjpa.jdbc.Schema - Reading table
> information for schema name "null", table name
> "PRP_Product_PRP_Company".
> 446  test  INFO   [main] openjpa.jdbc.Schema - Reading sequence
> information for schema "null", sequence name "null".
> 480  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Company".
> 482  test  INFO   [main] openjpa.MetaData - Parsing package
> "org.apache.openjpa.persistence.models.company.propertyaccess.Company".
> 512  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Address".
> 518  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Employee".
> 524  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Person".
> 533  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Product".
> 540  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.FullTimeEm
> ployee".
> 722  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.ProductOrd
> er".
> 733  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.Customer".
> 740  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.LineItem".
> 873  test  INFO   [main] openjpa.MetaData - Parsing class
> "org.apache.openjpa.persistence.models.company.propertyaccess.PartTimeEm
> ployee".
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> 63.348 sec <<< FAILURE!
> testBasicQueries
> (org.apache.openjpa.persistence.models.company.propertyaccess.TestProper
> tyCompanyModel)  Time elapsed: 63.322 sec  <<< ERROR!
> <0|false|0.0.0> org.apache.openjpa.persistence.PersistenceException:
> The exception 'java.lang.NullPointerException' was thrown while
> evaluating an expression. {prepstmnt 6533344 SELECT t0.id, t0.DTYPE,
> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM PRP_Person t0 LEFT
> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST(ABS
> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS VARCHAR(1000)))
> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS BIGINT) OR
> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE
> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1)
> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?)
> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT)
> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS BIGINT) > CAST(?
> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = ? OR LOWER
> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) <> CAST(?
> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS DOUBLE) OR
> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST(? AS
> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS BIGINT)
> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS BIGINT)))) AS
> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST(((CAST
> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST
> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR LTRIM(t1.firstName)
> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS VARCHAR(1000))) = ? OR
> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id IS NOT NULL
> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR t1.lastName IS
> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS REAL) OR CAST
> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS NOT NULL OR
> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 0, (long)
> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) x, (long)
> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,
> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1,
> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1,
> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0,
> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
> (String) PartTimeEmployee]} [code=30000, state=38000]
>          at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException
> (DBDictionary.java:3780)
>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
> (SQLExceptions.java:94)
>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
> (SQLExceptions.java:80)
>          at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore
> (SQLExceptions.java:56)
>          at
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedE
> xception(SelectResultObjectProvider.java:152)
>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> (EagerResultList.java:37)
>          at org.apache.openjpa.kernel.QueryImpl.toResult
> (QueryImpl.java:1214)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:981)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:791)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:761)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:757)
>          at org.apache.openjpa.kernel.DelegatingQuery.execute
> (DelegatingQuery.java:512)
>          at org.apache.openjpa.persistence.QueryImpl.execute
> (QueryImpl.java:225)
>          at org.apache.openjpa.persistence.QueryImpl.getResultList
> (QueryImpl.java:264)
>          at org.apache.openjpa.persistence.test.SingleEMTest.find
> (SingleEMTest.java:250)
>          at
> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBasic
> Queries(CompanyModelTest.java:99)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at junit.framework.TestCase.runTest(TestCase.java:154)
>          at junit.framework.TestCase.runBare(TestCase.java:127)
>          at junit.framework.TestResult$1.protect(TestResult.java:106)
>          at junit.framework.TestResult.runProtected(TestResult.java:124)
>          at junit.framework.TestResult.run(TestResult.java:109)
>          at junit.framework.TestCase.run(TestCase.java:118)
>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>          at junit.framework.TestSuite.run(TestSuite.java:203)
>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
> (JUnitTestSet.java:210)
>          at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
> t(AbstractDirectoryTestSuite.java:135)
>          at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> (AbstractDirectoryTestSuite.java:122)
>          at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> (SurefireBooter.java:225)
>          at org.apache.maven.surefire.booter.SurefireBooter.main
> (SurefireBooter.java:747)
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The
> exception 'java.lang.NullPointerException' was thrown while
> evaluating an expression. {prepstmnt 6533344 SELECT t0.id, t0.DTYPE,
> t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,
> t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,
> t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,
> t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,
> t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,
> t0.title, t0.salary, t0.wage, t0.weeklyHours FROM PRP_Person t0 LEFT
> OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN
> PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN
> PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address
> t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST(ABS
> (t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS
> VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST
> (t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS VARCHAR(1000)))
> = ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR
> (1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS
> BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS BIGINT) OR
> CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE
> (CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),
> CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1)
> + ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST
> ((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST
> (((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?)
> AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS
> VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT)
> - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS BIGINT) > CAST(?
> AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = ? OR LOWER
> (CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS
> VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) <> CAST(?
> AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS DOUBLE) OR
> SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS
> BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST(? AS
> BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS BIGINT)
> - CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)
> AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
> INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS BIGINT)))) AS
> INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS
> INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST(((CAST
> (? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST
> (? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS
> BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR LTRIM(t1.firstName)
> = ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST
> (t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS
> VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS VARCHAR(1000))) = ? OR
> t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id
> IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR
> t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR
> t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id
> IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR
> t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR
> t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id IS NOT NULL
> OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR t1.lastName IS
> NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST
> (t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=
> CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS REAL) OR CAST
> (t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >
> CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR
> t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS NOT NULL OR
> t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 0, (long)
> 0, (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
> (String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) x, (long)
> 1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)
> 1, (long) 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,
> (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,
> (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1,
> (int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1,
> (long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,
> (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,
> (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0,
> (long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,
> (String) PartTimeEmployee]} [code=30000, state=38000]
>          at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap
> (LoggingConnectionDecorator.java:188)
>          at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800
> (LoggingConnectionDecorator.java:53)
>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
> $LoggingConnection$LoggingPreparedStatement.executeQuery
> (LoggingConnectionDecorator.java:840)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:259)
>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:249)
>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> (SelectImpl.java:324)
>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> (SelectImpl.java:296)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion
> $UnionSelect.execute(LogicalUnion.java:402)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> (LogicalUnion.java:213)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> (LogicalUnion.java:203)
>          at
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
> (SelectResultObjectProvider.java:91)
>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> (EagerResultList.java:31)
>          ... 35 more
> NestedThrowables:
> ERROR 38000: The exception 'java.lang.NullPointerException' was
> thrown while evaluating an expression.
>          at org.apache.derby.iapi.error.StandardException.newException
> (Unknown Source)
>          at
> org.apache.derby.iapi.error.StandardException.unexpectedUserException
> (Unknown Source)
>          at
> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
> Source)
>          at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCor
> e(Unknown Source)
>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> (Unknown Source)
>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> (Unknown Source)
>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> (Unknown Source)
>          at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
> (Unknown Source)
>          at
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
> (Unknown Source)
>          at org.apache.derby.impl.sql.GenericPreparedStatement.execute
> (Unknown Source)
>          at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
> (Unknown Source)
>          at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
> (Unknown Source)
>          at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
> (Unknown Source)
>          at
> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:92)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:261)
>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
> $LoggingConnection$LoggingPreparedStatement.executeQuery
> (LoggingConnectionDecorator.java:838)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:259)
>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:249)
>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> (SelectImpl.java:324)
>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> (SelectImpl.java:296)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion
> $UnionSelect.execute(LogicalUnion.java:402)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> (LogicalUnion.java:213)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> (LogicalUnion.java:203)
>          at
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
> (SelectResultObjectProvider.java:91)
>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> (EagerResultList.java:31)
>          at org.apache.openjpa.kernel.QueryImpl.toResult
> (QueryImpl.java:1214)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:981)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:791)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:761)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:757)
>          at org.apache.openjpa.kernel.DelegatingQuery.execute
> (DelegatingQuery.java:512)
>          at org.apache.openjpa.persistence.QueryImpl.execute
> (QueryImpl.java:225)
>          at org.apache.openjpa.persistence.QueryImpl.getResultList
> (QueryImpl.java:264)
>          at org.apache.openjpa.persistence.test.SingleEMTest.find
> (SingleEMTest.java:250)
>          at
> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBasic
> Queries(CompanyModelTest.java:99)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at junit.framework.TestCase.runTest(TestCase.java:154)
>          at junit.framework.TestCase.runBare(TestCase.java:127)
>          at junit.framework.TestResult$1.protect(TestResult.java:106)
>          at junit.framework.TestResult.runProtected(TestResult.java:124)
>          at junit.framework.TestResult.run(TestResult.java:109)
>          at junit.framework.TestCase.run(TestCase.java:118)
>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>          at junit.framework.TestSuite.run(TestSuite.java:203)
>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
> (JUnitTestSet.java:210)
>          at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
> t(AbstractDirectoryTestSuite.java:135)
>          at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> (AbstractDirectoryTestSuite.java:122)
>          at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> (SurefireBooter.java:225)
>          at org.apache.maven.surefire.booter.SurefireBooter.main
> (SurefireBooter.java:747)
> java.lang.NullPointerException
>          at
> org.apache.derby.exe.ac80a29d05x0110xf079xcde5x0000000b87880.e11
> (Unknown Source)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at
> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
> Source)
>          at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCor
> e(Unknown Source)
>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> (Unknown Source)
>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> (Unknown Source)
>          at org.apache.derby.impl.sql.execute.JoinResultSet.openCore
> (Unknown Source)
>          at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
> (Unknown Source)
>          at
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
> (Unknown Source)
>          at org.apache.derby.impl.sql.GenericPreparedStatement.execute
> (Unknown Source)
>          at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement
> (Unknown Source)
>          at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
> (Unknown Source)
>          at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery
> (Unknown Source)
>          at
> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:92)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:261)
>          at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator
> $LoggingConnection$LoggingPreparedStatement.executeQuery
> (LoggingConnectionDecorator.java:838)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:259)
>          at org.apache.openjpa.jdbc.kernel.JDBCStoreManager
> $CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
>          at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:249)
>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> (SelectImpl.java:324)
>          at org.apache.openjpa.jdbc.sql.SelectImpl.execute
> (SelectImpl.java:296)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion
> $UnionSelect.execute(LogicalUnion.java:402)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> (LogicalUnion.java:213)
>          at org.apache.openjpa.jdbc.sql.LogicalUnion.execute
> (LogicalUnion.java:203)
>          at
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open
> (SelectResultObjectProvider.java:91)
>          at org.apache.openjpa.lib.rop.EagerResultList.<init>
> (EagerResultList.java:31)
>          at org.apache.openjpa.kernel.QueryImpl.toResult
> (QueryImpl.java:1214)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:981)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:791)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:761)
>          at org.apache.openjpa.kernel.QueryImpl.execute
> (QueryImpl.java:757)
>          at org.apache.openjpa.kernel.DelegatingQuery.execute
> (DelegatingQuery.java:512)
>          at org.apache.openjpa.persistence.QueryImpl.execute
> (QueryImpl.java:225)
>          at org.apache.openjpa.persistence.QueryImpl.getResultList
> (QueryImpl.java:264)
>          at org.apache.openjpa.persistence.test.SingleEMTest.find
> (SingleEMTest.java:250)
>          at
> org.apache.openjpa.persistence.models.company.CompanyModelTest.testBasic
> Queries(CompanyModelTest.java:99)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at junit.framework.TestCase.runTest(TestCase.java:154)
>          at junit.framework.TestCase.runBare(TestCase.java:127)
>          at junit.framework.TestResult$1.protect(TestResult.java:106)
>          at junit.framework.TestResult.runProtected(TestResult.java:124)
>          at junit.framework.TestResult.run(TestResult.java:109)
>          at junit.framework.TestCase.run(TestCase.java:118)
>          at junit.framework.TestSuite.runTest(TestSuite.java:208)
>          at junit.framework.TestSuite.run(TestSuite.java:203)
>          at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at org.apache.maven.surefire.junit.JUnitTestSet.execute
> (JUnitTestSet.java:210)
>          at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
> t(AbstractDirectoryTestSuite.java:135)
>          at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> (AbstractDirectoryTestSuite.java:122)
>          at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:585)
>          at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> (SurefireBooter.java:225)
>          at org.apache.maven.surefire.booter.SurefireBooter.main
> (SurefireBooter.java:747)
> ...
> Results :
> Tests run: 76, Failures: 0, Errors: 1, Skipped: 0
>
>
> On Feb 23, 2007, at 12:20 PM, Pinaki Poddar wrote:
>
> >> I should have the same code as you. Did you try changing the log
> > level?
> > Yes I too am  at
> > $svnversion -c
> > 406193:511043
> >
> > Changing log level to error in openjpa-persistence-jdbc/pom.xml did
> > not
> > impact the test failure.
> >
> >
> > Pinaki Poddar
> > BEA Systems
> > 415.402.7317
> >
> >
> > -----Original Message-----
> > From: Michael Dick [mailto:michael.d.dick@gmail.com]
> > Sent: Friday, February 23, 2007 11:58 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: Re: Test failure @ svn revision 511041
> >
> > I think so, that's what's specified in pom.xml (except for
> > openjpa-integration) and it should be picked up from there.
> >
> > Log entries like this show up when I run the tests :
> > 17  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "
> > org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0 -
> > (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
> >
> > Svnversion -c gives me this output :
> > mikedd@tessier:~/work/jpa/openjpa$ svnversion -c
> > 406193:511043
> >
> > I should have the same code as you. Did you try changing the log
> > level?
> >
> > On 2/23/07, Pinaki Poddar <pp...@bea.com> wrote:
> >>
> >> The stacktrace points that it *may* be a driver issue (the error is
> >> NPE with Derby driver and not an SQLException)
> >> java.lang.NullPointerException
> >>         at
> >> org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11
> >> (Unkno
> >> wn
> >> Source)
> >>
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> >> Source)
> >>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> >> Source)
> >>         at java.lang.reflect.Method.invoke(Unknown Source)
> >>         at
> >> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
> >> Source)
> >>         at
> >> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow
> >> C
> >> or
> >> e(Unknown Source)
> >>         at
> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> > Source)
> >>         at
> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> > Source)
> >>         at
> >> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> > Source)
> >>         at
> >> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore
> >> (Un
> >> kn
> >> own Source)
> >>         at
> >> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open
> >> (Unknown
> >> Source)
> >>         at
> >> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
> >> Source)
> >>         at
> >> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> >> Source)
> >>         at
> >> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement
> >> (Unk
> >> no
> >> wn Source)
> >>
> >>
> >> Are you using the same driver?
> >>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded JDBC
> >
> >>> Driver 10.2.2.0 - (485682)).
> >>
> >>
> >> Pinaki Poddar
> >> BEA Systems
> >> 415.402.7317
> >>
> >>
> >> -----Original Message-----
> >> From: Michael Dick [mailto:michael.d.dick@gmail.com]
> >> Sent: Friday, February 23, 2007 11:44 AM
> >> To: open-jpa-dev@incubator.apache.org
> >> Subject: Re: Test failure @ svn revision 511041
> >>
> >> The tests passed for me this morning on one of my systems, but I'll
> >> run again to make sure.
> >>
> >> FWIW, I am having the NPE problem with the tests on a different
> >> system
> >
> >> On that system I set the OpenJPA logging level to ERROR instead of
> >> INFO and the tests passed.  I'm guessing it's a hokey timing /
> >> filesystem thing, but I haven't had time to look at it too much.
> >>
> >> The tests just completed for me with  revision 511062, I think we're
> > ok.
> >>
> >> -Mike
> >>
> >>
> >> On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
> >>>
> >>> I haven't been able to run the persistence models test since my
> >>> email of a week or so ago.
> >>>
> >>> -Patrick
> >>>
> >>> --
> >>> Patrick Linskey
> >>> BEA Systems, Inc.
> >>>
> >>> ____________________________________________________________________
> >>> __
> >>> _
> >>> Notice:  This email message, together with any attachments, may
> >>> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >>> affiliated entities,  that may be confidential,  proprietary,
> >>> copyrighted  and/or legally privileged, and is intended solely for
> >>> the
> >>
> >>> use of the individual or entity named in this message. If you are
> >>> not the intended recipient, and have received this message in error,
> >
> >>> please immediately return this by email and then delete it.
> >>>
> >>>> -----Original Message-----
> >>>> From: Pinaki Poddar
> >>>> Sent: Friday, February 23, 2007 10:43 AM
> >>>> To: open-jpa-dev@incubator.apache.org
> >>>> Subject: Test failure @ svn revision 511041
> >>>>
> >>>> I am seeing a test failure @ revision 511041, $ mvn package
> >>>>
> >>>> The following test is failing:
> >>>> org.apache.openjpa.persistence.models.company.propertyaccess.T
> >>>> estPropert
> >>>> yCompanyModel#testBasicQueries
> >>>>
> >>>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded
> >>>> JDBC Driver 10.2.2.0 - (485682)).
> >>>>
> >>>> Will someone please verify that the tests are passing in their
> >>>> environment?
> >>>>
> >>>>
> >>>> Pinaki Poddar
> >>>> BEA Systems
> >>>> 415.402.7317
> >>>>
> >>>>
> >>>> ______________________________________________________________
> >>>> _________
> >>>> Notice:  This email message, together with any attachments, may
> >>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
> >>>> and affiliated entities,  that may be confidential,  proprietary,
> >>>> copyrighted  and/or legally privileged, and is intended solely for
> >
> >>>> the use of the individual or entity named in this message. If you
> >>>> are not the intended recipient, and have received this message in
> >>>> error, please immediately return this by email and then delete it.
> >>>>
> >>>>
> >>>
> >>
> >>
> >>
> >> --
> >> -Michael Dick
> >> _____________________________________________________________________
> >> _
> >> _
> >> Notice:  This email message, together with any attachments, may
> >> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >> affiliated entities,  that may be confidential,  proprietary,
> >> copyrighted  and/or legally privileged, and is intended solely for
> >> the
> >
> >> use of the individual or entity named in this message. If you are not
> >> the intended recipient, and have received this message in error,
> >> please immediately return this by email and then delete it.
> >>
> >
> >
> >
> > --
> > -Michael Dick
> > ______________________________________________________________________
> > _
> > Notice:  This email message, together with any attachments, may
> > contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated
> > entities,  that may be confidential,  proprietary,  copyrighted
> > and/or
> > legally privileged, and is intended solely for the use of the
> > individual
> > or entity named in this message. If you are not the intended
> > recipient,
> > and have received this message in error, please immediately return
> > this
> > by email and then delete it.
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
>
>
> --
-Michael Dick

Re: Test failure @ svn revision 511041

Posted by Craig L Russell <Cr...@Sun.COM>.
I still get failures on the checked-out HEAD.

Updated to revision 511104.
%mvn install
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   OpenJPA
[INFO]   OpenJPA Utilities
[INFO]   OpenJPA Kernel
[INFO]   OpenJPA JDBC
[INFO]   OpenJPA XML Store
[INFO]   OpenJPA JDBC 1.5
[INFO]   OpenJPA Kernel 1.5
[INFO]   OpenJPA JPA
[INFO]   OpenJPA JPA JDBC
[INFO]   OpenJPA Aggregate Jar
[INFO]   OpenJPA Persistence Examples
[INFO]   OpenJPA Distribution
[INFO]   OpenJPA Integration Tests
[INFO]   OpenJPA Examples Integration Tests
[INFO]   OpenJPA JPA TCK Integration Tests
...

Running  
org.apache.openjpa.persistence.models.company.propertyaccess.TestPropert 
yCompanyModel
1  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.0.0
10  test  INFO   [main] openjpa.jdbc.JDBC - OpenJPA will now connect  
to the database to attempt to determine what type of database  
dictionary to use.  To prevent this connection in the future, set  
your openjpa.jdbc.DBDictionary configuration property to the  
appropriate value for your database (see the documentation for  
available values).
16  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class  
"org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0  
- (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
22  test  INFO   [main] openjpa.MetaData - Found 10 classes with  
metadata in 1 milliseconds.
30  test  INFO   [main] openjpa.MetaData - Found 10 classes with  
metadata in 1 milliseconds.
31  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.FullTimeEm 
ployee".
32  test  INFO   [main] openjpa.MetaData - Parsing package  
"org.apache.openjpa.persistence.models.company.propertyaccess.FullTimeEm 
ployee".
43  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Employee".
51  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Person".
58  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Address".
68  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Company".
140  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Product".
156  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.LineItem".
164  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Customer".
172  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.ProductOrd 
er".
183  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.PartTimeEm 
ployee".
219  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name "PRP_Address".
227  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name "PRP_Company".
235  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name "PRP_LineItem".
313  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name "PRP_Person".
324  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name "PRP_Product".
369  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name "PRP_ProductOrder".
378  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name  
"PRP_ProductOrder_PRP_LineItem".
385  test  INFO   [main] openjpa.jdbc.Schema - Reading table  
information for schema name "null", table name  
"PRP_Product_PRP_Company".
446  test  INFO   [main] openjpa.jdbc.Schema - Reading sequence  
information for schema "null", sequence name "null".
480  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Company".
482  test  INFO   [main] openjpa.MetaData - Parsing package  
"org.apache.openjpa.persistence.models.company.propertyaccess.Company".
512  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Address".
518  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Employee".
524  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Person".
533  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Product".
540  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.FullTimeEm 
ployee".
722  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.ProductOrd 
er".
733  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.Customer".
740  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.LineItem".
873  test  INFO   [main] openjpa.MetaData - Parsing class  
"org.apache.openjpa.persistence.models.company.propertyaccess.PartTimeEm 
ployee".
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:  
63.348 sec <<< FAILURE!
testBasicQueries 
(org.apache.openjpa.persistence.models.company.propertyaccess.TestProper 
tyCompanyModel)  Time elapsed: 63.322 sec  <<< ERROR!
<0|false|0.0.0> org.apache.openjpa.persistence.PersistenceException:  
The exception 'java.lang.NullPointerException' was thrown while  
evaluating an expression. {prepstmnt 6533344 SELECT t0.id, t0.DTYPE,  
t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,  
t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,  
t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,  
t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,  
t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,  
t0.title, t0.salary, t0.wage, t0.weeklyHours FROM PRP_Person t0 LEFT  
OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN  
PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN  
PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address  
t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST(ABS 
(t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS  
VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST 
(t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS VARCHAR(1000)))  
= ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR 
(1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS  
BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS BIGINT) OR  
CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE 
(CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),  
CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1)  
+ ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST 
((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST 
(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?)  
AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS  
VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT)  
- CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS BIGINT) > CAST(?  
AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = ? OR LOWER 
(CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS  
VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) <> CAST(?  
AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS DOUBLE) OR  
SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS  
BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST(? AS  
BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS BIGINT)  
- CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)  
AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS  
INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS BIGINT)))) AS  
INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS  
INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST(((CAST 
(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST 
(? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS  
BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR LTRIM(t1.firstName)  
= ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST 
(t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS  
VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS VARCHAR(1000))) = ? OR  
t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id  
IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR  
t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR  
t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id  
IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR  
t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR  
t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id IS NOT NULL  
OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR t1.lastName IS  
NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST 
(t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=  
CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS REAL) OR CAST 
(t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >  
CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR  
t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS NOT NULL OR  
t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 0, (long)  
0, (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,  
(String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) x, (long)  
1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)  
1, (long) 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,  
(long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,  
(String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1,  
(int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1,  
(long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,  
(String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,  
(long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0,  
(long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,  
(String) PartTimeEmployee]} [code=30000, state=38000]
         at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException 
(DBDictionary.java:3780)
         at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore 
(SQLExceptions.java:94)
         at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore 
(SQLExceptions.java:80)
         at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore 
(SQLExceptions.java:56)
         at  
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedE 
xception(SelectResultObjectProvider.java:152)
         at org.apache.openjpa.lib.rop.EagerResultList.<init> 
(EagerResultList.java:37)
         at org.apache.openjpa.kernel.QueryImpl.toResult 
(QueryImpl.java:1214)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:981)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:791)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:761)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:757)
         at org.apache.openjpa.kernel.DelegatingQuery.execute 
(DelegatingQuery.java:512)
         at org.apache.openjpa.persistence.QueryImpl.execute 
(QueryImpl.java:225)
         at org.apache.openjpa.persistence.QueryImpl.getResultList 
(QueryImpl.java:264)
         at org.apache.openjpa.persistence.test.SingleEMTest.find 
(SingleEMTest.java:250)
         at  
org.apache.openjpa.persistence.models.company.CompanyModelTest.testBasic 
Queries(CompanyModelTest.java:99)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.maven.surefire.junit.JUnitTestSet.execute 
(JUnitTestSet.java:210)
         at  
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe 
t(AbstractDirectoryTestSuite.java:135)
         at  
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute 
(AbstractDirectoryTestSuite.java:122)
         at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at  
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess 
(SurefireBooter.java:225)
         at org.apache.maven.surefire.booter.SurefireBooter.main 
(SurefireBooter.java:747)
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The  
exception 'java.lang.NullPointerException' was thrown while  
evaluating an expression. {prepstmnt 6533344 SELECT t0.id, t0.DTYPE,  
t0.firstName, t2.id, t2.city, t2.phoneNumber, t2.postalCode,  
t2.state, t2.streetAddress, t0.lastName, t3.id, t4.id, t4.city,  
t4.phoneNumber, t4.postalCode, t4.state, t4.streetAddress, t3.name,  
t0.hireDate, t1.id, t1.DTYPE, t1.firstName, t1.homeAddress_id,  
t1.lastName, t1.company_id, t1.hireDate, t1.title, t1.salary,  
t0.title, t0.salary, t0.wage, t0.weeklyHours FROM PRP_Person t0 LEFT  
OUTER JOIN PRP_Person t1 ON t0.manager_id = t1.id LEFT OUTER JOIN  
PRP_Address t2 ON t0.homeAddress_id = t2.id LEFT OUTER JOIN  
PRP_Company t3 ON t0.company_id = t3.id LEFT OUTER JOIN PRP_Address  
t4 ON t3.address_id = t4.id WHERE (ABS(t0.manager_id) <> ? OR CAST(ABS 
(t1.salary) AS REAL) <> CAST(? AS REAL) OR (CAST(t1.firstName AS  
VARCHAR(1000)))||(CAST(t1.firstName AS VARCHAR(1000))) = ? OR (CAST 
(t1.lastName AS VARCHAR(1000)))||(CAST(t1.lastName AS VARCHAR(1000)))  
= ? OR (CAST(t1.title AS VARCHAR(1000)))||(CAST(t1.title AS VARCHAR 
(1000))) = ? OR CAST(LENGTH(t1.firstName) AS BIGINT) > CAST(? AS  
BIGINT) OR CAST(LENGTH(t1.lastName) AS BIGINT) > CAST(? AS BIGINT) OR  
CAST(LENGTH(t1.title) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE 
(CAST((t1.firstName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)),  
CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1)  
+ ?) AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST 
((t1.lastName) AS VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST 
(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?)  
AS BIGINT) > CAST(? AS BIGINT) OR CAST(((LOCATE(CAST((t1.title) AS  
VARCHAR(1000)), CAST((?) AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT)  
- CAST(? AS BIGINT))) AS INTEGER) + 1) - 1) + ?) AS BIGINT) > CAST(?  
AS BIGINT) OR LOWER(CAST(t1.firstName AS VARCHAR(1000))) = ? OR LOWER 
(CAST(t1.lastName AS VARCHAR(1000))) = ? OR LOWER(CAST(t1.title AS  
VARCHAR(1000))) = ? OR CAST(SQRT(t0.manager_id) AS DOUBLE) <> CAST(?  
AS DOUBLE) OR CAST(SQRT(t1.salary) AS DOUBLE) <> CAST(? AS DOUBLE) OR  
SUBSTR(CAST((t1.firstName) AS VARCHAR(1000)), CAST(((CAST(? AS  
BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST(? AS  
BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS BIGINT)  
- CAST(? AS BIGINT))) AS INTEGER)) = ? OR SUBSTR(CAST((t1.lastName)  
AS VARCHAR(1000)), CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS  
INTEGER) + 1, CAST(((? + (CAST(? AS BIGINT) - CAST(? AS BIGINT)))) AS  
INTEGER) - CAST(((CAST(? AS BIGINT) - CAST(? AS BIGINT))) AS  
INTEGER)) = ? OR SUBSTR(CAST((t1.title) AS VARCHAR(1000)), CAST(((CAST 
(? AS BIGINT) - CAST(? AS BIGINT))) AS INTEGER) + 1, CAST(((? + (CAST 
(? AS BIGINT) - CAST(? AS BIGINT)))) AS INTEGER) - CAST(((CAST(? AS  
BIGINT) - CAST(? AS BIGINT))) AS INTEGER)) = ? OR LTRIM(t1.firstName)  
= ? OR LTRIM(t1.lastName) = ? OR LTRIM(t1.title) = ? OR UPPER(CAST 
(t1.firstName AS VARCHAR(1000))) = ? OR UPPER(CAST(t1.lastName AS  
VARCHAR(1000))) = ? OR UPPER(CAST(t1.title AS VARCHAR(1000))) = ? OR  
t0.manager_id IS NOT NULL OR t0.manager_id IS NULL OR t1.company_id  
IS NOT NULL OR t1.company_id IS NULL OR t1.firstName IS NOT NULL OR  
t1.firstName IS NULL OR t1.hireDate <> CURRENT_TIMESTAMP OR  
t1.hireDate IS NOT NULL OR t1.hireDate IS NULL OR t1.homeAddress_id  
IS NOT NULL OR t1.homeAddress_id IS NULL OR t0.manager_id < ? OR  
t0.manager_id <= ? OR t0.manager_id <> ? OR t0.manager_id = ? OR  
t0.manager_id > ? OR t0.manager_id >= ? OR t0.manager_id IS NOT NULL  
OR t0.manager_id IS NULL OR t1.lastName IS NOT NULL OR t1.lastName IS  
NULL OR t1.manager_id IS NOT NULL OR t1.manager_id IS NULL OR CAST 
(t1.salary AS REAL) < CAST(? AS REAL) OR CAST(t1.salary AS REAL) <=  
CAST(? AS REAL) OR CAST(t1.salary AS REAL) <> CAST(? AS REAL) OR CAST 
(t1.salary AS REAL) = CAST(? AS REAL) OR CAST(t1.salary AS REAL) >  
CAST(? AS REAL) OR CAST(t1.salary AS REAL) >= CAST(? AS REAL) OR  
t1.salary IS NOT NULL OR t1.salary IS NULL OR t1.title IS NOT NULL OR  
t1.title IS NULL) AND t0.DTYPE IN (?, ?, ?) [params=(long) 0, (long)  
0, (String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,  
(String) x, (long) 1, (int) 1, (int) 1, (long) 0, (String) x, (long)  
1, (int) 1, (int) 1, (long) 0, (String) x, (long) 1, (int) 1, (int)  
1, (long) 0, (String) x, (String) x, (String) x, (long) 0, (long) 0,  
(long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1, (int) 1,  
(String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1, (long) 1,  
(int) 1, (String) x, (long) 1, (int) 1, (long) 2, (long) 1, (int) 1,  
(long) 1, (int) 1, (String) x, (String) x, (String) x, (String) x,  
(String) x, (String) x, (String) x, (long) 0, (long) 0, (long) 0,  
(long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0, (long) 0,  
(long) 0, (long) 0, (String) Employee, (String) FullTimeEmployee,  
(String) PartTimeEmployee]} [code=30000, state=38000]
         at  
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap 
(LoggingConnectionDecorator.java:188)
         at  
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800 
(LoggingConnectionDecorator.java:53)
         at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator 
$LoggingConnection$LoggingPreparedStatement.executeQuery 
(LoggingConnectionDecorator.java:840)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:259)
         at org.apache.openjpa.jdbc.kernel.JDBCStoreManager 
$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:249)
         at org.apache.openjpa.jdbc.sql.SelectImpl.execute 
(SelectImpl.java:324)
         at org.apache.openjpa.jdbc.sql.SelectImpl.execute 
(SelectImpl.java:296)
         at org.apache.openjpa.jdbc.sql.LogicalUnion 
$UnionSelect.execute(LogicalUnion.java:402)
         at org.apache.openjpa.jdbc.sql.LogicalUnion.execute 
(LogicalUnion.java:213)
         at org.apache.openjpa.jdbc.sql.LogicalUnion.execute 
(LogicalUnion.java:203)
         at  
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open 
(SelectResultObjectProvider.java:91)
         at org.apache.openjpa.lib.rop.EagerResultList.<init> 
(EagerResultList.java:31)
         ... 35 more
NestedThrowables:
ERROR 38000: The exception 'java.lang.NullPointerException' was  
thrown while evaluating an expression.
         at org.apache.derby.iapi.error.StandardException.newException 
(Unknown Source)
         at  
org.apache.derby.iapi.error.StandardException.unexpectedUserException 
(Unknown Source)
         at  
org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown  
Source)
         at  
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCor 
e(Unknown Source)
         at org.apache.derby.impl.sql.execute.JoinResultSet.openCore 
(Unknown Source)
         at org.apache.derby.impl.sql.execute.JoinResultSet.openCore 
(Unknown Source)
         at org.apache.derby.impl.sql.execute.JoinResultSet.openCore 
(Unknown Source)
         at  
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore 
(Unknown Source)
         at  
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open 
(Unknown Source)
         at org.apache.derby.impl.sql.GenericPreparedStatement.execute 
(Unknown Source)
         at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement 
(Unknown Source)
         at  
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement 
(Unknown Source)
         at  
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery 
(Unknown Source)
         at  
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:92)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:261)
         at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator 
$LoggingConnection$LoggingPreparedStatement.executeQuery 
(LoggingConnectionDecorator.java:838)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:259)
         at org.apache.openjpa.jdbc.kernel.JDBCStoreManager 
$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:249)
         at org.apache.openjpa.jdbc.sql.SelectImpl.execute 
(SelectImpl.java:324)
         at org.apache.openjpa.jdbc.sql.SelectImpl.execute 
(SelectImpl.java:296)
         at org.apache.openjpa.jdbc.sql.LogicalUnion 
$UnionSelect.execute(LogicalUnion.java:402)
         at org.apache.openjpa.jdbc.sql.LogicalUnion.execute 
(LogicalUnion.java:213)
         at org.apache.openjpa.jdbc.sql.LogicalUnion.execute 
(LogicalUnion.java:203)
         at  
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open 
(SelectResultObjectProvider.java:91)
         at org.apache.openjpa.lib.rop.EagerResultList.<init> 
(EagerResultList.java:31)
         at org.apache.openjpa.kernel.QueryImpl.toResult 
(QueryImpl.java:1214)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:981)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:791)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:761)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:757)
         at org.apache.openjpa.kernel.DelegatingQuery.execute 
(DelegatingQuery.java:512)
         at org.apache.openjpa.persistence.QueryImpl.execute 
(QueryImpl.java:225)
         at org.apache.openjpa.persistence.QueryImpl.getResultList 
(QueryImpl.java:264)
         at org.apache.openjpa.persistence.test.SingleEMTest.find 
(SingleEMTest.java:250)
         at  
org.apache.openjpa.persistence.models.company.CompanyModelTest.testBasic 
Queries(CompanyModelTest.java:99)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.maven.surefire.junit.JUnitTestSet.execute 
(JUnitTestSet.java:210)
         at  
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe 
t(AbstractDirectoryTestSuite.java:135)
         at  
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute 
(AbstractDirectoryTestSuite.java:122)
         at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at  
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess 
(SurefireBooter.java:225)
         at org.apache.maven.surefire.booter.SurefireBooter.main 
(SurefireBooter.java:747)
java.lang.NullPointerException
         at  
org.apache.derby.exe.ac80a29d05x0110xf079xcde5x0000000b87880.e11 
(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at  
org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown  
Source)
         at  
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCor 
e(Unknown Source)
         at org.apache.derby.impl.sql.execute.JoinResultSet.openCore 
(Unknown Source)
         at org.apache.derby.impl.sql.execute.JoinResultSet.openCore 
(Unknown Source)
         at org.apache.derby.impl.sql.execute.JoinResultSet.openCore 
(Unknown Source)
         at  
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore 
(Unknown Source)
         at  
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open 
(Unknown Source)
         at org.apache.derby.impl.sql.GenericPreparedStatement.execute 
(Unknown Source)
         at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement 
(Unknown Source)
         at  
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement 
(Unknown Source)
         at  
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery 
(Unknown Source)
         at  
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:92)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:261)
         at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator 
$LoggingConnection$LoggingPreparedStatement.executeQuery 
(LoggingConnectionDecorator.java:838)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:259)
         at org.apache.openjpa.jdbc.kernel.JDBCStoreManager 
$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1369)
         at  
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery 
(DelegatingPreparedStatement.java:249)
         at org.apache.openjpa.jdbc.sql.SelectImpl.execute 
(SelectImpl.java:324)
         at org.apache.openjpa.jdbc.sql.SelectImpl.execute 
(SelectImpl.java:296)
         at org.apache.openjpa.jdbc.sql.LogicalUnion 
$UnionSelect.execute(LogicalUnion.java:402)
         at org.apache.openjpa.jdbc.sql.LogicalUnion.execute 
(LogicalUnion.java:213)
         at org.apache.openjpa.jdbc.sql.LogicalUnion.execute 
(LogicalUnion.java:203)
         at  
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open 
(SelectResultObjectProvider.java:91)
         at org.apache.openjpa.lib.rop.EagerResultList.<init> 
(EagerResultList.java:31)
         at org.apache.openjpa.kernel.QueryImpl.toResult 
(QueryImpl.java:1214)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:981)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:791)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:761)
         at org.apache.openjpa.kernel.QueryImpl.execute 
(QueryImpl.java:757)
         at org.apache.openjpa.kernel.DelegatingQuery.execute 
(DelegatingQuery.java:512)
         at org.apache.openjpa.persistence.QueryImpl.execute 
(QueryImpl.java:225)
         at org.apache.openjpa.persistence.QueryImpl.getResultList 
(QueryImpl.java:264)
         at org.apache.openjpa.persistence.test.SingleEMTest.find 
(SingleEMTest.java:250)
         at  
org.apache.openjpa.persistence.models.company.CompanyModelTest.testBasic 
Queries(CompanyModelTest.java:99)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.maven.surefire.junit.JUnitTestSet.execute 
(JUnitTestSet.java:210)
         at  
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe 
t(AbstractDirectoryTestSuite.java:135)
         at  
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute 
(AbstractDirectoryTestSuite.java:122)
         at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at  
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess 
(SurefireBooter.java:225)
         at org.apache.maven.surefire.booter.SurefireBooter.main 
(SurefireBooter.java:747)
...
Results :
Tests run: 76, Failures: 0, Errors: 1, Skipped: 0


On Feb 23, 2007, at 12:20 PM, Pinaki Poddar wrote:

>> I should have the same code as you. Did you try changing the log
> level?
> Yes I too am  at
> $svnversion -c
> 406193:511043
>
> Changing log level to error in openjpa-persistence-jdbc/pom.xml did  
> not
> impact the test failure.
>
>
> Pinaki Poddar
> BEA Systems
> 415.402.7317
>
>
> -----Original Message-----
> From: Michael Dick [mailto:michael.d.dick@gmail.com]
> Sent: Friday, February 23, 2007 11:58 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: Test failure @ svn revision 511041
>
> I think so, that's what's specified in pom.xml (except for
> openjpa-integration) and it should be picked up from there.
>
> Log entries like this show up when I run the tests :
> 17  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "
> org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0 -
> (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
>
> Svnversion -c gives me this output :
> mikedd@tessier:~/work/jpa/openjpa$ svnversion -c
> 406193:511043
>
> I should have the same code as you. Did you try changing the log  
> level?
>
> On 2/23/07, Pinaki Poddar <pp...@bea.com> wrote:
>>
>> The stacktrace points that it *may* be a driver issue (the error is
>> NPE with Derby driver and not an SQLException)
>> java.lang.NullPointerException
>>         at
>> org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11 
>> (Unkno
>> wn
>> Source)
>>
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown  
>> Source)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>> Source)
>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>         at
>> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
>> Source)
>>         at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow 
>> C
>> or
>> e(Unknown Source)
>>         at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> Source)
>>         at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> Source)
>>         at
>> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
> Source)
>>         at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore 
>> (Un
>> kn
>> own Source)
>>         at
>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open 
>> (Unknown
>> Source)
>>         at
>> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
>> Source)
>>         at
>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
>> Source)
>>         at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement 
>> (Unk
>> no
>> wn Source)
>>
>>
>> Are you using the same driver?
>>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded JDBC
>
>>> Driver 10.2.2.0 - (485682)).
>>
>>
>> Pinaki Poddar
>> BEA Systems
>> 415.402.7317
>>
>>
>> -----Original Message-----
>> From: Michael Dick [mailto:michael.d.dick@gmail.com]
>> Sent: Friday, February 23, 2007 11:44 AM
>> To: open-jpa-dev@incubator.apache.org
>> Subject: Re: Test failure @ svn revision 511041
>>
>> The tests passed for me this morning on one of my systems, but I'll
>> run again to make sure.
>>
>> FWIW, I am having the NPE problem with the tests on a different  
>> system
>
>> On that system I set the OpenJPA logging level to ERROR instead of
>> INFO and the tests passed.  I'm guessing it's a hokey timing /
>> filesystem thing, but I haven't had time to look at it too much.
>>
>> The tests just completed for me with  revision 511062, I think we're
> ok.
>>
>> -Mike
>>
>>
>> On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
>>>
>>> I haven't been able to run the persistence models test since my
>>> email of a week or so ago.
>>>
>>> -Patrick
>>>
>>> --
>>> Patrick Linskey
>>> BEA Systems, Inc.
>>>
>>> ____________________________________________________________________
>>> __
>>> _
>>> Notice:  This email message, together with any attachments, may
>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
>>> affiliated entities,  that may be confidential,  proprietary,
>>> copyrighted  and/or legally privileged, and is intended solely for
>>> the
>>
>>> use of the individual or entity named in this message. If you are
>>> not the intended recipient, and have received this message in error,
>
>>> please immediately return this by email and then delete it.
>>>
>>>> -----Original Message-----
>>>> From: Pinaki Poddar
>>>> Sent: Friday, February 23, 2007 10:43 AM
>>>> To: open-jpa-dev@incubator.apache.org
>>>> Subject: Test failure @ svn revision 511041
>>>>
>>>> I am seeing a test failure @ revision 511041, $ mvn package
>>>>
>>>> The following test is failing:
>>>> org.apache.openjpa.persistence.models.company.propertyaccess.T
>>>> estPropert
>>>> yCompanyModel#testBasicQueries
>>>>
>>>> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded
>>>> JDBC Driver 10.2.2.0 - (485682)).
>>>>
>>>> Will someone please verify that the tests are passing in their
>>>> environment?
>>>>
>>>>
>>>> Pinaki Poddar
>>>> BEA Systems
>>>> 415.402.7317
>>>>
>>>>
>>>> ______________________________________________________________
>>>> _________
>>>> Notice:  This email message, together with any attachments, may
>>>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
>>>> and affiliated entities,  that may be confidential,  proprietary,
>>>> copyrighted  and/or legally privileged, and is intended solely for
>
>>>> the use of the individual or entity named in this message. If you
>>>> are not the intended recipient, and have received this message in
>>>> error, please immediately return this by email and then delete it.
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> -Michael Dick
>> _____________________________________________________________________ 
>> _
>> _
>> Notice:  This email message, together with any attachments, may
>> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
>> affiliated entities,  that may be confidential,  proprietary,
>> copyrighted  and/or legally privileged, and is intended solely for  
>> the
>
>> use of the individual or entity named in this message. If you are not
>> the intended recipient, and have received this message in error,
>> please immediately return this by email and then delete it.
>>
>
>
>
> --
> -Michael Dick
> ______________________________________________________________________ 
> _
> Notice:  This email message, together with any attachments, may  
> contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and   
> affiliated
> entities,  that may be confidential,  proprietary,  copyrighted   
> and/or
> legally privileged, and is intended solely for the use of the  
> individual
> or entity named in this message. If you are not the intended  
> recipient,
> and have received this message in error, please immediately return  
> this
> by email and then delete it.

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


RE: Test failure @ svn revision 511041

Posted by Pinaki Poddar <pp...@bea.com>.
> I should have the same code as you. Did you try changing the log
level?
Yes I too am  at
$svnversion -c
406193:511043

Changing log level to error in openjpa-persistence-jdbc/pom.xml did not
impact the test failure.


Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Michael Dick [mailto:michael.d.dick@gmail.com] 
Sent: Friday, February 23, 2007 11:58 AM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Test failure @ svn revision 511041

I think so, that's what's specified in pom.xml (except for
openjpa-integration) and it should be picked up from there.

Log entries like this show up when I run the tests :
17  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "
org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0 -
(485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).

Svnversion -c gives me this output :
mikedd@tessier:~/work/jpa/openjpa$ svnversion -c
406193:511043

I should have the same code as you. Did you try changing the log level?

On 2/23/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> The stacktrace points that it *may* be a driver issue (the error is 
> NPE with Derby driver and not an SQLException) 
> java.lang.NullPointerException
>         at
> org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11(Unkno
> wn
> Source)
>
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at
> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
> Source)
>         at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowC
> or
> e(Unknown Source)
>         at
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
Source)
>         at
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
Source)
>         at
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown
Source)
>         at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Un
> kn
> own Source)
>         at
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown
> Source)
>         at
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
> Source)
>         at
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> Source)
>         at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unk
> no
> wn Source)
>
>
> Are you using the same driver?
> > Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded JDBC

> > Driver 10.2.2.0 - (485682)).
>
>
> Pinaki Poddar
> BEA Systems
> 415.402.7317
>
>
> -----Original Message-----
> From: Michael Dick [mailto:michael.d.dick@gmail.com]
> Sent: Friday, February 23, 2007 11:44 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: Test failure @ svn revision 511041
>
> The tests passed for me this morning on one of my systems, but I'll 
> run again to make sure.
>
> FWIW, I am having the NPE problem with the tests on a different system

> On that system I set the OpenJPA logging level to ERROR instead of 
> INFO and the tests passed.  I'm guessing it's a hokey timing / 
> filesystem thing, but I haven't had time to look at it too much.
>
> The tests just completed for me with  revision 511062, I think we're
ok.
>
> -Mike
>
>
> On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
> >
> > I haven't been able to run the persistence models test since my 
> > email of a week or so ago.
> >
> > -Patrick
> >
> > --
> > Patrick Linskey
> > BEA Systems, Inc.
> >
> > ____________________________________________________________________
> > __
> > _
> > Notice:  This email message, together with any attachments, may 
> > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and 
> > affiliated entities,  that may be confidential,  proprietary, 
> > copyrighted  and/or legally privileged, and is intended solely for 
> > the
>
> > use of the individual or entity named in this message. If you are 
> > not the intended recipient, and have received this message in error,

> > please immediately return this by email and then delete it.
> >
> > > -----Original Message-----
> > > From: Pinaki Poddar
> > > Sent: Friday, February 23, 2007 10:43 AM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: Test failure @ svn revision 511041
> > >
> > > I am seeing a test failure @ revision 511041, $ mvn package
> > >
> > > The following test is failing:
> > > org.apache.openjpa.persistence.models.company.propertyaccess.T
> > > estPropert
> > > yCompanyModel#testBasicQueries
> > >
> > > Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded 
> > > JDBC Driver 10.2.2.0 - (485682)).
> > >
> > > Will someone please verify that the tests are passing in their 
> > > environment?
> > >
> > >
> > > Pinaki Poddar
> > > BEA Systems
> > > 415.402.7317
> > >
> > >
> > > ______________________________________________________________
> > > _________
> > > Notice:  This email message, together with any attachments, may 
> > > contain information  of  BEA Systems,  Inc.,  its subsidiaries  
> > > and affiliated entities,  that may be confidential,  proprietary, 
> > > copyrighted  and/or legally privileged, and is intended solely for

> > > the use of the individual or entity named in this message. If you 
> > > are not the intended recipient, and have received this message in 
> > > error, please immediately return this by email and then delete it.
> > >
> > >
> >
>
>
>
> --
> -Michael Dick
> ______________________________________________________________________
> _
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>



--
-Michael Dick
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Re: Test failure @ svn revision 511041

Posted by Michael Dick <mi...@gmail.com>.
I think so, that's what's specified in pom.xml (except for
openjpa-integration) and it should be picked up from there.

Log entries like this show up when I run the tests :
17  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "
org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0 -
(485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).

Svnversion -c gives me this output :
mikedd@tessier:~/work/jpa/openjpa$ svnversion -c
406193:511043

I should have the same code as you. Did you try changing the log level?

On 2/23/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> The stacktrace points that it *may* be a driver issue (the error is NPE
> with Derby driver and not an SQLException)
> java.lang.NullPointerException
>         at
> org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11(Unknown
> Source)
>
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at
> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
> Source)
>         at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCor
> e(Unknown Source)
>         at
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown Source)
>         at
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown Source)
>         at
> org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown Source)
>         at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unkn
> own Source)
>         at
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown
> Source)
>         at
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
> Source)
>         at
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> Source)
>         at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unkno
> wn Source)
>
>
> Are you using the same driver?
> > Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded JDBC
> >  Driver 10.2.2.0 - (485682)).
>
>
> Pinaki Poddar
> BEA Systems
> 415.402.7317
>
>
> -----Original Message-----
> From: Michael Dick [mailto:michael.d.dick@gmail.com]
> Sent: Friday, February 23, 2007 11:44 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: Test failure @ svn revision 511041
>
> The tests passed for me this morning on one of my systems, but I'll run
> again to make sure.
>
> FWIW, I am having the NPE problem with the tests on a different system
> On that system I set the OpenJPA logging level to ERROR instead of INFO
> and the tests passed.  I'm guessing it's a hokey timing / filesystem
> thing, but I haven't had time to look at it too much.
>
> The tests just completed for me with  revision 511062, I think we're ok.
>
> -Mike
>
>
> On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
> >
> > I haven't been able to run the persistence models test since my email
> > of a week or so ago.
> >
> > -Patrick
> >
> > --
> > Patrick Linskey
> > BEA Systems, Inc.
> >
> > ______________________________________________________________________
> > _
> > Notice:  This email message, together with any attachments, may
> > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated entities,  that may be confidential,  proprietary,
> > copyrighted  and/or legally privileged, and is intended solely for the
>
> > use of the individual or entity named in this message. If you are not
> > the intended recipient, and have received this message in error,
> > please immediately return this by email and then delete it.
> >
> > > -----Original Message-----
> > > From: Pinaki Poddar
> > > Sent: Friday, February 23, 2007 10:43 AM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: Test failure @ svn revision 511041
> > >
> > > I am seeing a test failure @ revision 511041, $ mvn package
> > >
> > > The following test is failing:
> > > org.apache.openjpa.persistence.models.company.propertyaccess.T
> > > estPropert
> > > yCompanyModel#testBasicQueries
> > >
> > > Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded JDBC
> > > Driver 10.2.2.0 - (485682)).
> > >
> > > Will someone please verify that the tests are passing in their
> > > environment?
> > >
> > >
> > > Pinaki Poddar
> > > BEA Systems
> > > 415.402.7317
> > >
> > >
> > > ______________________________________________________________
> > > _________
> > > Notice:  This email message, together with any attachments, may
> > > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > affiliated entities,  that may be confidential,  proprietary,
> > > copyrighted  and/or legally privileged, and is intended solely for
> > > the use of the individual or entity named in this message. If you
> > > are not the intended recipient, and have received this message in
> > > error, please immediately return this by email and then delete it.
> > >
> > >
> >
>
>
>
> --
> -Michael Dick
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>



-- 
-Michael Dick

RE: Test failure @ svn revision 511041

Posted by Pinaki Poddar <pp...@bea.com>.
The stacktrace points that it *may* be a driver issue (the error is NPE
with Derby driver and not an SQLException)
java.lang.NullPointerException
        at
org.apache.derby.exe.ac9a855bfax0110xefd2xc9f7x0000000780800.e11(Unknown
Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
Source)
        at
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCor
e(Unknown Source)
        at
org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown Source)
        at
org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown Source)
        at
org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown Source)
        at
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unkn
own Source)
        at
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown
Source)
        at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
Source)
        at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source)
        at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unkno
wn Source)


Are you using the same driver?
> Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded JDBC 
>  Driver 10.2.2.0 - (485682)).


Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Michael Dick [mailto:michael.d.dick@gmail.com] 
Sent: Friday, February 23, 2007 11:44 AM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Test failure @ svn revision 511041

The tests passed for me this morning on one of my systems, but I'll run
again to make sure.

FWIW, I am having the NPE problem with the tests on a different system
On that system I set the OpenJPA logging level to ERROR instead of INFO
and the tests passed.  I'm guessing it's a hokey timing / filesystem
thing, but I haven't had time to look at it too much.

The tests just completed for me with  revision 511062, I think we're ok.

-Mike


On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
>
> I haven't been able to run the persistence models test since my email 
> of a week or so ago.
>
> -Patrick
>
> --
> Patrick Linskey
> BEA Systems, Inc.
>
> ______________________________________________________________________
> _
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>
> > -----Original Message-----
> > From: Pinaki Poddar
> > Sent: Friday, February 23, 2007 10:43 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: Test failure @ svn revision 511041
> >
> > I am seeing a test failure @ revision 511041, $ mvn package
> >
> > The following test is failing:
> > org.apache.openjpa.persistence.models.company.propertyaccess.T
> > estPropert
> > yCompanyModel#testBasicQueries
> >
> > Runs on Apache Derby 10.2.2.0 - (485682) Apache Derby Embedded JDBC 
> > Driver 10.2.2.0 - (485682)).
> >
> > Will someone please verify that the tests are passing in their 
> > environment?
> >
> >
> > Pinaki Poddar
> > BEA Systems
> > 415.402.7317
> >
> >
> > ______________________________________________________________
> > _________
> > Notice:  This email message, together with any attachments, may 
> > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and 
> > affiliated entities,  that may be confidential,  proprietary, 
> > copyrighted  and/or legally privileged, and is intended solely for 
> > the use of the individual or entity named in this message. If you 
> > are not the intended recipient, and have received this message in 
> > error, please immediately return this by email and then delete it.
> >
> >
>



--
-Michael Dick
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Re: Test failure @ svn revision 511041

Posted by Michael Dick <mi...@gmail.com>.
The tests passed for me this morning on one of my systems, but I'll run
again to make sure.

FWIW, I am having the NPE problem with the tests on a different system On
that system I set the OpenJPA logging level to ERROR instead of INFO and the
tests passed.  I'm guessing it's a hokey timing / filesystem thing, but I
haven't had time to look at it too much.

The tests just completed for me with  revision 511062, I think we're ok.

-Mike


On 2/23/07, Patrick Linskey <pl...@bea.com> wrote:
>
> I haven't been able to run the persistence models test since my email of
> a week or so ago.
>
> -Patrick
>
> --
> Patrick Linskey
> BEA Systems, Inc.
>
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>
> > -----Original Message-----
> > From: Pinaki Poddar
> > Sent: Friday, February 23, 2007 10:43 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: Test failure @ svn revision 511041
> >
> > I am seeing a test failure @ revision 511041,
> > $ mvn package
> >
> > The following test is failing:
> > org.apache.openjpa.persistence.models.company.propertyaccess.T
> > estPropert
> > yCompanyModel#testBasicQueries
> >
> > Runs on Apache Derby 10.2.2.0 - (485682)
> > Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
> >
> > Will someone please verify that the tests are passing in their
> > environment?
> >
> >
> > Pinaki Poddar
> > BEA Systems
> > 415.402.7317
> >
> >
> > ______________________________________________________________
> > _________
> > Notice:  This email message, together with any attachments,
> > may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated
> > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > legally privileged, and is intended solely for the use of the
> > individual
> > or entity named in this message. If you are not the intended
> > recipient,
> > and have received this message in error, please immediately
> > return this
> > by email and then delete it.
> >
> >
>



-- 
-Michael Dick

RE: Test failure @ svn revision 511041

Posted by Patrick Linskey <pl...@bea.com>.
I haven't been able to run the persistence models test since my email of
a week or so ago.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Pinaki Poddar 
> Sent: Friday, February 23, 2007 10:43 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: Test failure @ svn revision 511041 
> 
> I am seeing a test failure @ revision 511041, 
> $ mvn package 
> 
> The following test is failing:
> org.apache.openjpa.persistence.models.company.propertyaccess.T
> estPropert
> yCompanyModel#testBasicQueries
> 
> Runs on Apache Derby 10.2.2.0 - (485682) 
> Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).
> 
> Will someone please verify that the tests are passing in their
> environment?
> 
> 
> Pinaki Poddar
> BEA Systems
> 415.402.7317  
> 
> 
> ______________________________________________________________
> _________
> Notice:  This email message, together with any attachments, 
> may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated
> entities,  that may be confidential,  proprietary,  
> copyrighted  and/or
> legally privileged, and is intended solely for the use of the 
> individual
> or entity named in this message. If you are not the intended 
> recipient,
> and have received this message in error, please immediately 
> return this
> by email and then delete it. 
> 
> 

Test failure @ svn revision 511041

Posted by Pinaki Poddar <pp...@bea.com>.
I am seeing a test failure @ revision 511041, 
$ mvn package 

The following test is failing:
org.apache.openjpa.persistence.models.company.propertyaccess.TestPropert
yCompanyModel#testBasicQueries

Runs on Apache Derby 10.2.2.0 - (485682) 
Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)).

Will someone please verify that the tests are passing in their
environment?


Pinaki Poddar
BEA Systems
415.402.7317  


_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 


AW: TYPO? Howto integrate JPA within EJB2.1 session beans? [architecture]

Posted by "Hans J. Prueller" <ha...@gmx.net>.
no probl. ;-)

have a nice weekend - hopefully mine is going to be fine with a working
OpenJPA engine in our java2ee 1.4 container *gg*

regards,
hans



> -----Ursprüngliche Nachricht-----
> Von: Patrick Linskey [mailto:plinskey@bea.com]
> Gesendet: Freitag, 23. Februar 2007 18:46
> An: open-jpa-dev@incubator.apache.org
> Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
> [architecture]
> 
> Typo indeed. It should be OpenJPAPersistence.toBrokerFactory(emf). Sorry
> about that.
> 
> -Patrick
> 
> --
> Patrick Linskey
> BEA Systems, Inc.
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
> 
> > -----Original Message-----
> > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > Sent: Friday, February 23, 2007 9:43 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > beans? [architecture]
> >
> > Patrick,
> >
> > I'm currently trying your tip with a PersistenceService util
> > class doing
> > the lookup of a synchronized entity manager. The problem is
> > that your sample
> > code does not work!
> >
> > in fact the statement
> >
> > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> >
> > is the problem. the above "cast" does not return a
> > BrokerFactory instance!
> >
> > I am using a 2 days old nightly snapshot 0.9.7 build
> >
> > Where is the problem?
> >
> > Hans
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > An: open-jpa-dev@incubator.apache.org
> > > Betreff: RE: RE: Howto integrate JPA within EJB2.1 session beans?
> > > [architecture]
> > >
> > > > Unfortunately, that means that we're using a synchronized
> > > > block during the lookup. If it looks like EM lookup is a
> > > > scalability issue for your app, do let us know -- it would
> > > > be pretty straightforward to replace the synchronized block
> > > > with a concurrent map.
> > >
> > > OK, I got fed up with that synchronized block. OPENJPA-161
> > tracks the
> > > issue; I've got a patch that I'll submit once some more
> > eyes look at it.
> > >
> > > -Patrick
> > >
> > > --
> > > Patrick Linskey
> > > BEA Systems, Inc.
> > >
> > >
> > ______________________________________________________________
> > _________
> > > Notice:  This email message, together with any attachments,
> > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >  affiliated
> > > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of
> > the individual
> > > or entity named in this message. If you are not the
> > intended recipient,
> > > and have received this message in error, please immediately
> > return this
> > > by email and then delete it.
> > >
> > > > -----Original Message-----
> > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > To: open-jpa-dev@incubator.apache.org
> > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > beans? [architecture]
> > > >
> > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > onserver startup like.
> > > > >
> > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > >
> > > > Yep.
> > > >
> > > > >         //does the statement below again create a NEW EMF
> > > > or ist this
> > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > called "Create"
> > > > >         //and not get?
> > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > >             .createEntityManagerFactory(
> > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > >
> > > > It's just a lookup. I'm not sure why it's called 'create'. Anyone?
> > > >
> > > > >         //why do I have to create a new
> > > > broker/entitymanager this way?
> > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > transaction
> > > > >         //context with the newly created entitymanager?
> > > >
> > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > all create new
> > > > EMs. The broker code will look up one associated with the current
> > > > transaction, which is what you're looking for.
> > > >
> > > > Unfortunately, that means that we're using a synchronized
> > block during
> > > > the lookup. If it looks like EM lookup is a scalability
> > issue for your
> > > > app, do let us know -- it would be pretty straightforward to
> > > > replace the
> > > > synchronized block with a concurrent map.
> > > >
> > > > > So if understand that right I just would have to call
> > > > >
> > > > > PersistenceService.getEntitymanager();
> > > > >
> > > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > > >
> > > > Yep.
> > > >
> > > > > I really appreciate your help - it's quite complex to integrate
> > > > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> > > >
> > > > Yes -- sorry about that. We should at least be creating
> > > > better-designed
> > > > helper methods in OpenJPA to help out with this.
> > > >
> > > > One alternative, of course, is to use Spring 2, which does a
> > > > pretty good
> > > > job of JPA bootstrapping.
> > > >
> > > > -Patrick
> > > >
> > > > --
> > > > Patrick Linskey
> > > > BEA Systems, Inc.
> > > >
> > > > ______________________________________________________________
> > > > _________
> > > > Notice:  This email message, together with any attachments,
> > > > may contain
> > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > affiliated
> > > > entities,  that may be confidential,  proprietary,
> > > > copyrighted  and/or
> > > > legally privileged, and is intended solely for the use of the
> > > > individual
> > > > or entity named in this message. If you are not the intended
> > > > recipient,
> > > > and have received this message in error, please immediately
> > > > return this
> > > > by email and then delete it.
> > > >
> > > > > -----Original Message-----
> > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > open-jpa-dev@incubator.apache.org
> > > > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session
> > > > > beans? [architecture]
> > > > >
> > > > > Patrick,
> > > > >
> > > > > thank you for that tip. To be true, I was not aware of
> > > > > lifecycle related problems between my SLSBs and JPA - thank
> > > > > you for that hint. As I want to avoid working with
> > > > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > >
> > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > onserver startup like.
> > > > >
> > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > >
> > > > > I would be interested what the code for the
> > > > > PersistenceService class does:
> > > > >
> > > > >
> > > > >         //does the statement below again create a NEW EMF
> > > > or ist this
> > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > called "Create"
> > > > >         //and not get?
> > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > >             .createEntityManagerFactory(
> > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > >
> > > > >         //why do i have to cast the EMF to a
> > brokerfactory now? I
> > > > >         //would guess the "broker" is something like a
> > more abstract
> > > > >         //concept of entitymanager(factory)?
> > > > >
> > > > >         //why do I have to create a new
> > > > broker/entitymanager this way?
> > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > transaction
> > > > >         //context with the newly created entitymanager?
> > > > >
> > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > >         Broker b = bf.newBroker(
> > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > >           true, // the broker is part of a JTA managed tx
> > > > >
> > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > >           true); // look for an existing Broker on the tx
> > > > >
> > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > >         broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > >         broker.setDetachedNew(false);
> > > > >
> > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > >     }
> > > > >
> > > > > So if understand that right I just would have to call
> > > > >
> > > > > PersistenceService.getEntitymanager();
> > > > >
> > > > > in every SLSB method (NOT in ejbCreate) when needed? fine. I
> > > > > really appreciate your help - it's quite complex to integrate
> > > > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> > > > >
> > > > > regards
> > > > > Hans
> > > > >
> > > > > -------- Original-Nachricht --------
> > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > An: open-jpa-dev@incubator.apache.org
> > > > > CC:
> > > > > Betreff: RE: Howto integrate JPA within EJB2.1 session beans?
> > > > > [architecture]
> > > > >
> > > > > > Another common technique is to get an EMF into JNDI, either
> > > > > by using a
> > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > >
> > > > > > Are you looking to integrate OpenJPA with your current managed
> > > > > > transaction? If so, I'd be careful about creating an EM in
> > > > > ejbCreate(),
> > > > > > as its lifecycle is related to the life of the SLSB,
> > not to the
> > > > > > transactional context (the SLSB might be pooled). So, I'd
> > > > > just try to
> > > > > > get the EMF into JNDI when the server starts (creating EMFs
> > > > > is slow).
> > > > > > Then, you could avoid having to use your own ThreadLocal
> > > > > work by using
> > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > >
> > > > > > public class PersistenceService {
> > > > > >     public static EntityManager getEntityManager() {
> > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > >             .createEntityManagerFactory(
> > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > >         Broker b = bf.newBroker(
> > > > > >             bf.getConfiguration().getConnectionUserName(),
> > > > > >             bf.getConfiguration().getConnectionPassword(),
> > > > > >             true, // the broker is part of a JTA managed tx
> > > > > >
> > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > >             true); // look for an existing Broker on the tx
> > > > > >
> > > > > >         // do some JPA configuration setup. Logic stolen from
> > > > > >         // EntityManagerFactoryImpl.
> > > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > >
> > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > >         broker.setDetachedNew(false);
> > > > > >
> > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > >     }
> > > > > > }
> > > > > >
> > > > > > Meanwhile, we really should add a couple new
> > OpenJPAPersistence /
> > > > > > OpenJPAEntityManagerFactory methods to help out with
> > this type of
> > > > > > bootstrapping.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > BEA Systems, Inc.
> > > > > >
> > > > > >
> > > > > ______________________________________________________________
> > > > > _________
> > > > > > Notice:  This email message, together with any attachments,
> > > > > may contain
> > > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > >  affiliated
> > > > > > entities,  that may be confidential,  proprietary,
> > > > > copyrighted  and/or
> > > > > > legally privileged, and is intended solely for the use of
> > > > > the individual
> > > > > > or entity named in this message. If you are not the
> > > > > intended recipient,
> > > > > > and have received this message in error, please immediately
> > > > > return this
> > > > > > by email and then delete it.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > Subject: Howto integrate JPA within EJB2.1 session beans?
> > > > > > > [architecture]
> > > > > > >
> > > > > > > Hi together,
> > > > > > >
> > > > > > > I'm sorry for bothering you with numerous basic questions
> > > > > > > regarding OpenJPA and its usage but I have to migrate
> > > > > > > existing CMP EJBs to migrate within short time to OpenJPA as
> > > > > > > we're having stability issues with the current CMP engine.
> > > > > > >
> > > > > > > One last question I'd like to ask is regarding the
> > > > > > > recommended architecture of using OpenJPA within EJB2.1
> > > > > > > Stateless sessino beans:
> > > > > > >
> > > > > > > I need to work with persistence i.e. the EntityManager
> > > > > > > throughout all the session beans methods so my idea is to:
> > > > > > >
> > > > > > > - create a EntityManagerFactory in the ejbCreate() method
> > > > > of the SLSB
> > > > > > > - and also create the EntityManager itself in the
> > > > > > > ejbCreeate() method and store it as a member variable
> > > > of the SLSB
> > > > > > > - this would allow easy access within the SB's methods by
> > > > > > > just using the already initialized entity manager varialbe
> > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > - clean up should be performed in the ejbRemove() method
> > > > > of the SLSB
> > > > > > >
> > > > > > > I think doing so will allow migratino to openJPA with less
> > > > > > > work than doing the whole lookup procedure in every method
> > > > > > > separately.
> > > > > > >
> > > > > > > what do you think? are there any pitfalls i've overlooked?
> > > > > > >
> > > > > > > thank you for your ideas!
> > > > > > >
> > > > > > > regards
> > > > > > > Hans
> > > > > > > --
> > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > Jetzt GMX ProMail testen:
> > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > >
> > > > >
> > > > > --
> > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > Jetzt GMX ProMail testen:
> > www.gmx.net/de/go/mailfooter/promail-out
> > > > >
> > > >
> >
> >


EMF JNDI lookup is starting openJPA every time - was: Howto integrate JPA within EJB2.1 session beans?

Posted by "Hans J. Prueller" <ha...@gmx.net>.
Hi together, Patrick,

the code you suggested for doing a helper method that deals with the EMF
JNDI lookup and the EM creating within our J2EE1.4 app basically works fine,
but as you perhaps may remember I asked why the method is called "create":

EntityManagerFactory myemf =
OpenJPAPersistence.createEntityManagerFactory(strJNDILocation,
(Context)null);

It seems that the method above really creates a NEW EMF on every invocation!
I checked the logs of my application and I see the following messages on
every invocation of my PersistenceService.getEntityManger() method (which
does the above lookup and some more ..)

2007-02-25 07:27:05,687 : PersistenceService.getEntityManager : creating a
fresh
, clean EntityManager from JNDI EMF.
15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] openjpa.Runtime -
Starti
ng OpenJPA 0.9.7-incubating-SNAPSHOT
15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] openjpa.jdbc.JDBC -
Open
JPA will now connect to the database to attempt to determine what type of
databa
se dictionary to use.  To prevent this connection in the future, set your
openjp
a.jdbc.DBDictionary configuration property to the appropriate value for your
dat
abase (see the documentation for available values).
15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] openjpa.jdbc.JDBC -
Usin
g dictionary class "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL
5.0.27-c
ommunity-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
2006-10-19
 17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
15  lbsims  INFO   [RMI TCP Connection(35)-192.168.0.5] openjpa.MetaData -
Found
 1 classes with metadata in 0 milliseconds.


It seems that OpenJPA is now bootstrapping everytime I access it. I am
binding the EMF somewhen at bootstrapping time with

final EntityManagerFactory emFactory = Persistence
				.createEntityManagerFactory("lbsims");

Context ictx = new InitialContext();
ictx.bind(PersistenceService.EMF_JNDI_LOCATION, emFactory);

The lookup uses the same constants, so the EMF in JNDI should be found?

EntityManagerFactory emf = OpenJPAPersistence
	
.createEntityManagerFactory(EMF_JNDI_LOCATION, (Context) null);

Any Idea what could be wrong here?

regards,
HANS


> -----Ursprüngliche Nachricht-----
> Von: Patrick Linskey [mailto:plinskey@bea.com]
> Gesendet: Freitag, 23. Februar 2007 18:46
> An: open-jpa-dev@incubator.apache.org
> Betreff: RE: TYPO? Howto integrate JPA within EJB2.1 session beans?
> [architecture]
> 
> Typo indeed. It should be OpenJPAPersistence.toBrokerFactory(emf). Sorry
> about that.
> 
> -Patrick
> 
> --
> Patrick Linskey
> BEA Systems, Inc.
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
> 
> > -----Original Message-----
> > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > Sent: Friday, February 23, 2007 9:43 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session
> > beans? [architecture]
> >
> > Patrick,
> >
> > I'm currently trying your tip with a PersistenceService util
> > class doing
> > the lookup of a synchronized entity manager. The problem is
> > that your sample
> > code does not work!
> >
> > in fact the statement
> >
> > final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> >
> > is the problem. the above "cast" does not return a
> > BrokerFactory instance!
> >
> > I am using a 2 days old nightly snapshot 0.9.7 build
> >
> > Where is the problem?
> >
> > Hans
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > > An: open-jpa-dev@incubator.apache.org
> > > Betreff: RE: RE: Howto integrate JPA within EJB2.1 session beans?
> > > [architecture]
> > >
> > > > Unfortunately, that means that we're using a synchronized
> > > > block during the lookup. If it looks like EM lookup is a
> > > > scalability issue for your app, do let us know -- it would
> > > > be pretty straightforward to replace the synchronized block
> > > > with a concurrent map.
> > >
> > > OK, I got fed up with that synchronized block. OPENJPA-161
> > tracks the
> > > issue; I've got a patch that I'll submit once some more
> > eyes look at it.
> > >
> > > -Patrick
> > >
> > > --
> > > Patrick Linskey
> > > BEA Systems, Inc.
> > >
> > >
> > ______________________________________________________________
> > _________
> > > Notice:  This email message, together with any attachments,
> > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >  affiliated
> > > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of
> > the individual
> > > or entity named in this message. If you are not the
> > intended recipient,
> > > and have received this message in error, please immediately
> > return this
> > > by email and then delete it.
> > >
> > > > -----Original Message-----
> > > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > > Sent: Thursday, February 22, 2007 8:38 AM
> > > > To: open-jpa-dev@incubator.apache.org
> > > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > > beans? [architecture]
> > > >
> > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > onserver startup like.
> > > > >
> > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > >
> > > > Yep.
> > > >
> > > > >         //does the statement below again create a NEW EMF
> > > > or ist this
> > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > called "Create"
> > > > >         //and not get?
> > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > >             .createEntityManagerFactory(
> > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > >
> > > > It's just a lookup. I'm not sure why it's called 'create'. Anyone?
> > > >
> > > > >         //why do I have to create a new
> > > > broker/entitymanager this way?
> > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > transaction
> > > > >         //context with the newly created entitymanager?
> > > >
> > > > Yes -- our current OpenJPAPersistence EM lookup methods
> > all create new
> > > > EMs. The broker code will look up one associated with the current
> > > > transaction, which is what you're looking for.
> > > >
> > > > Unfortunately, that means that we're using a synchronized
> > block during
> > > > the lookup. If it looks like EM lookup is a scalability
> > issue for your
> > > > app, do let us know -- it would be pretty straightforward to
> > > > replace the
> > > > synchronized block with a concurrent map.
> > > >
> > > > > So if understand that right I just would have to call
> > > > >
> > > > > PersistenceService.getEntitymanager();
> > > > >
> > > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > > >
> > > > Yep.
> > > >
> > > > > I really appreciate your help - it's quite complex to integrate
> > > > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> > > >
> > > > Yes -- sorry about that. We should at least be creating
> > > > better-designed
> > > > helper methods in OpenJPA to help out with this.
> > > >
> > > > One alternative, of course, is to use Spring 2, which does a
> > > > pretty good
> > > > job of JPA bootstrapping.
> > > >
> > > > -Patrick
> > > >
> > > > --
> > > > Patrick Linskey
> > > > BEA Systems, Inc.
> > > >
> > > > ______________________________________________________________
> > > > _________
> > > > Notice:  This email message, together with any attachments,
> > > > may contain
> > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > affiliated
> > > > entities,  that may be confidential,  proprietary,
> > > > copyrighted  and/or
> > > > legally privileged, and is intended solely for the use of the
> > > > individual
> > > > or entity named in this message. If you are not the intended
> > > > recipient,
> > > > and have received this message in error, please immediately
> > > > return this
> > > > by email and then delete it.
> > > >
> > > > > -----Original Message-----
> > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > > To: open-jpa-dev@incubator.apache.org;
> > > > > open-jpa-dev@incubator.apache.org
> > > > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session
> > > > > beans? [architecture]
> > > > >
> > > > > Patrick,
> > > > >
> > > > > thank you for that tip. To be true, I was not aware of
> > > > > lifecycle related problems between my SLSBs and JPA - thank
> > > > > you for that hint. As I want to avoid working with
> > > > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > > > yet) I would prefer the JNDI-EMF based approach.
> > > > >
> > > > > If I understand it correct, I "just" have to bind the EMF
> > > > > onserver startup like.
> > > > >
> > > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > > >
> > > > > I would be interested what the code for the
> > > > > PersistenceService class does:
> > > > >
> > > > >
> > > > >         //does the statement below again create a NEW EMF
> > > > or ist this
> > > > >         //just a lookup in the jndi-tree? but why is it
> > > > > called "Create"
> > > > >         //and not get?
> > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > >             .createEntityManagerFactory(
> > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > >
> > > > >         //why do i have to cast the EMF to a
> > brokerfactory now? I
> > > > >         //would guess the "broker" is something like a
> > more abstract
> > > > >         //concept of entitymanager(factory)?
> > > > >
> > > > >         //why do I have to create a new
> > > > broker/entitymanager this way?
> > > > >         //is this because I have to "synchronize" the SLSBs
> > > > > transaction
> > > > >         //context with the newly created entitymanager?
> > > > >
> > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > >         Broker b = bf.newBroker(
> > > > >         bf.getConfiguration().getConnectionUserName(),
> > > > >           bf.getConfiguration().getConnectionPassword(),
> > > > >           true, // the broker is part of a JTA managed tx
> > > > >
> > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > >           true); // look for an existing Broker on the tx
> > > > >
> > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > >         broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > >         broker.setDetachedNew(false);
> > > > >
> > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > >     }
> > > > >
> > > > > So if understand that right I just would have to call
> > > > >
> > > > > PersistenceService.getEntitymanager();
> > > > >
> > > > > in every SLSB method (NOT in ejbCreate) when needed? fine. I
> > > > > really appreciate your help - it's quite complex to integrate
> > > > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> > > > >
> > > > > regards
> > > > > Hans
> > > > >
> > > > > -------- Original-Nachricht --------
> > > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > > An: open-jpa-dev@incubator.apache.org
> > > > > CC:
> > > > > Betreff: RE: Howto integrate JPA within EJB2.1 session beans?
> > > > > [architecture]
> > > > >
> > > > > > Another common technique is to get an EMF into JNDI, either
> > > > > by using a
> > > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > > >
> > > > > > Are you looking to integrate OpenJPA with your current managed
> > > > > > transaction? If so, I'd be careful about creating an EM in
> > > > > ejbCreate(),
> > > > > > as its lifecycle is related to the life of the SLSB,
> > not to the
> > > > > > transactional context (the SLSB might be pooled). So, I'd
> > > > > just try to
> > > > > > get the EMF into JNDI when the server starts (creating EMFs
> > > > > is slow).
> > > > > > Then, you could avoid having to use your own ThreadLocal
> > > > > work by using
> > > > > > the internal OpenJPA BrokerFactory APIs:
> > > > > >
> > > > > > public class PersistenceService {
> > > > > >     public static EntityManager getEntityManager() {
> > > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > > >             .createEntityManagerFactory(
> > > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > > >         Broker b = bf.newBroker(
> > > > > >             bf.getConfiguration().getConnectionUserName(),
> > > > > >             bf.getConfiguration().getConnectionPassword(),
> > > > > >             true, // the broker is part of a JTA managed tx
> > > > > >
> > > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > > >             true); // look for an existing Broker on the tx
> > > > > >
> > > > > >         // do some JPA configuration setup. Logic stolen from
> > > > > >         // EntityManagerFactoryImpl.
> > > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > > >
> > broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > > >         broker.setDetachedNew(false);
> > > > > >
> > > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > > >     }
> > > > > > }
> > > > > >
> > > > > > Meanwhile, we really should add a couple new
> > OpenJPAPersistence /
> > > > > > OpenJPAEntityManagerFactory methods to help out with
> > this type of
> > > > > > bootstrapping.
> > > > > >
> > > > > > -Patrick
> > > > > >
> > > > > > --
> > > > > > Patrick Linskey
> > > > > > BEA Systems, Inc.
> > > > > >
> > > > > >
> > > > > ______________________________________________________________
> > > > > _________
> > > > > > Notice:  This email message, together with any attachments,
> > > > > may contain
> > > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > > >  affiliated
> > > > > > entities,  that may be confidential,  proprietary,
> > > > > copyrighted  and/or
> > > > > > legally privileged, and is intended solely for the use of
> > > > > the individual
> > > > > > or entity named in this message. If you are not the
> > > > > intended recipient,
> > > > > > and have received this message in error, please immediately
> > > > > return this
> > > > > > by email and then delete it.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > > Subject: Howto integrate JPA within EJB2.1 session beans?
> > > > > > > [architecture]
> > > > > > >
> > > > > > > Hi together,
> > > > > > >
> > > > > > > I'm sorry for bothering you with numerous basic questions
> > > > > > > regarding OpenJPA and its usage but I have to migrate
> > > > > > > existing CMP EJBs to migrate within short time to OpenJPA as
> > > > > > > we're having stability issues with the current CMP engine.
> > > > > > >
> > > > > > > One last question I'd like to ask is regarding the
> > > > > > > recommended architecture of using OpenJPA within EJB2.1
> > > > > > > Stateless sessino beans:
> > > > > > >
> > > > > > > I need to work with persistence i.e. the EntityManager
> > > > > > > throughout all the session beans methods so my idea is to:
> > > > > > >
> > > > > > > - create a EntityManagerFactory in the ejbCreate() method
> > > > > of the SLSB
> > > > > > > - and also create the EntityManager itself in the
> > > > > > > ejbCreeate() method and store it as a member variable
> > > > of the SLSB
> > > > > > > - this would allow easy access within the SB's methods by
> > > > > > > just using the already initialized entity manager varialbe
> > > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > > - clean up should be performed in the ejbRemove() method
> > > > > of the SLSB
> > > > > > >
> > > > > > > I think doing so will allow migratino to openJPA with less
> > > > > > > work than doing the whole lookup procedure in every method
> > > > > > > separately.
> > > > > > >
> > > > > > > what do you think? are there any pitfalls i've overlooked?
> > > > > > >
> > > > > > > thank you for your ideas!
> > > > > > >
> > > > > > > regards
> > > > > > > Hans
> > > > > > > --
> > > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > > Jetzt GMX ProMail testen:
> > > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > > >
> > > > >
> > > > > --
> > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > Jetzt GMX ProMail testen:
> > www.gmx.net/de/go/mailfooter/promail-out
> > > > >
> > > >
> >
> >


RE: TYPO? Howto integrate JPA within EJB2.1 session beans? [architecture]

Posted by Patrick Linskey <pl...@bea.com>.
Typo indeed. It should be OpenJPAPersistence.toBrokerFactory(emf). Sorry about that.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> Sent: Friday, February 23, 2007 9:43 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: TYPO? Howto integrate JPA within EJB2.1 session 
> beans? [architecture]
> 
> Patrick,
> 
> I'm currently trying your tip with a PersistenceService util 
> class doing
> the lookup of a synchronized entity manager. The problem is 
> that your sample
> code does not work!
> 
> in fact the statement 
> 
> final BrokerFactory bf = OpenJPAPersistence.cast(emf);
> 
> is the problem. the above "cast" does not return a 
> BrokerFactory instance!
> 
> I am using a 2 days old nightly snapshot 0.9.7 build 
> 
> Where is the problem? 
> 
> Hans
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Patrick Linskey [mailto:plinskey@bea.com]
> > Gesendet: Donnerstag, 22. Februar 2007 23:22
> > An: open-jpa-dev@incubator.apache.org
> > Betreff: RE: RE: Howto integrate JPA within EJB2.1 session beans?
> > [architecture]
> > 
> > > Unfortunately, that means that we're using a synchronized
> > > block during the lookup. If it looks like EM lookup is a
> > > scalability issue for your app, do let us know -- it would
> > > be pretty straightforward to replace the synchronized block
> > > with a concurrent map.
> > 
> > OK, I got fed up with that synchronized block. OPENJPA-161 
> tracks the
> > issue; I've got a patch that I'll submit once some more 
> eyes look at it.
> > 
> > -Patrick
> > 
> > --
> > Patrick Linskey
> > BEA Systems, Inc.
> > 
> > 
> ______________________________________________________________
> _________
> > Notice:  This email message, together with any attachments, 
> may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and 
>  affiliated
> > entities,  that may be confidential,  proprietary,  
> copyrighted  and/or
> > legally privileged, and is intended solely for the use of 
> the individual
> > or entity named in this message. If you are not the 
> intended recipient,
> > and have received this message in error, please immediately 
> return this
> > by email and then delete it.
> > 
> > > -----Original Message-----
> > > From: Patrick Linskey [mailto:plinskey@bea.com]
> > > Sent: Thursday, February 22, 2007 8:38 AM
> > > To: open-jpa-dev@incubator.apache.org
> > > Subject: RE: RE: Howto integrate JPA within EJB2.1 session
> > > beans? [architecture]
> > >
> > > > If I understand it correct, I "just" have to bind the EMF
> > > > onserver startup like.
> > > >
> > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > >
> > > Yep.
> > >
> > > >         //does the statement below again create a NEW EMF
> > > or ist this
> > > >         //just a lookup in the jndi-tree? but why is it
> > > > called "Create"
> > > >         //and not get?
> > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > >             .createEntityManagerFactory(
> > > >                 "your/EMF/JNDI/location", (Context) null);
> > >
> > > It's just a lookup. I'm not sure why it's called 'create'. Anyone?
> > >
> > > >         //why do I have to create a new
> > > broker/entitymanager this way?
> > > >         //is this because I have to "synchronize" the SLSBs
> > > > transaction
> > > >         //context with the newly created entitymanager?
> > >
> > > Yes -- our current OpenJPAPersistence EM lookup methods 
> all create new
> > > EMs. The broker code will look up one associated with the current
> > > transaction, which is what you're looking for.
> > >
> > > Unfortunately, that means that we're using a synchronized 
> block during
> > > the lookup. If it looks like EM lookup is a scalability 
> issue for your
> > > app, do let us know -- it would be pretty straightforward to
> > > replace the
> > > synchronized block with a concurrent map.
> > >
> > > > So if understand that right I just would have to call
> > > >
> > > > PersistenceService.getEntitymanager();
> > > >
> > > > in every SLSB method (NOT in ejbCreate) when needed? fine.
> > >
> > > Yep.
> > >
> > > > I really appreciate your help - it's quite complex to integrate
> > > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> > >
> > > Yes -- sorry about that. We should at least be creating
> > > better-designed
> > > helper methods in OpenJPA to help out with this.
> > >
> > > One alternative, of course, is to use Spring 2, which does a
> > > pretty good
> > > job of JPA bootstrapping.
> > >
> > > -Patrick
> > >
> > > --
> > > Patrick Linskey
> > > BEA Systems, Inc.
> > >
> > > ______________________________________________________________
> > > _________
> > > Notice:  This email message, together with any attachments,
> > > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > affiliated
> > > entities,  that may be confidential,  proprietary,
> > > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of the
> > > individual
> > > or entity named in this message. If you are not the intended
> > > recipient,
> > > and have received this message in error, please immediately
> > > return this
> > > by email and then delete it.
> > >
> > > > -----Original Message-----
> > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > Sent: Thursday, February 22, 2007 4:36 AM
> > > > To: open-jpa-dev@incubator.apache.org;
> > > > open-jpa-dev@incubator.apache.org
> > > > Subject: Re: RE: Howto integrate JPA within EJB2.1 session
> > > > beans? [architecture]
> > > >
> > > > Patrick,
> > > >
> > > > thank you for that tip. To be true, I was not aware of
> > > > lifecycle related problems between my SLSBs and JPA - thank
> > > > you for that hint. As I want to avoid working with
> > > > ThreadLocal (simply because I didn't work with ThreadLocals
> > > > yet) I would prefer the JNDI-EMF based approach.
> > > >
> > > > If I understand it correct, I "just" have to bind the EMF
> > > > onserver startup like.
> > > >
> > > > context.bind("my/jndi/name/for/emf",myEMFVariable);
> > > >
> > > > I would be interested what the code for the
> > > > PersistenceService class does:
> > > >
> > > >
> > > >         //does the statement below again create a NEW EMF
> > > or ist this
> > > >         //just a lookup in the jndi-tree? but why is it
> > > > called "Create"
> > > >         //and not get?
> > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > >             .createEntityManagerFactory(
> > > >                 "your/EMF/JNDI/location", (Context) null);
> > > >
> > > >         //why do i have to cast the EMF to a 
> brokerfactory now? I
> > > >         //would guess the "broker" is something like a 
> more abstract
> > > >         //concept of entitymanager(factory)?
> > > >
> > > >         //why do I have to create a new
> > > broker/entitymanager this way?
> > > >         //is this because I have to "synchronize" the SLSBs
> > > > transaction
> > > >         //context with the newly created entitymanager?
> > > >
> > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > >         Broker b = bf.newBroker(
> > > >         bf.getConfiguration().getConnectionUserName(),
> > > >           bf.getConfiguration().getConnectionPassword(),
> > > >           true, // the broker is part of a JTA managed tx
> > > >           
> bf.getConfiguration().getConnectionRetainModeConstant(),
> > > >           true); // look for an existing Broker on the tx
> > > >
> > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > >         broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > >         broker.setDetachedNew(false);
> > > >
> > > >         return OpenJPAPersistence.toEntityManager(b);
> > > >     }
> > > >
> > > > So if understand that right I just would have to call
> > > >
> > > > PersistenceService.getEntitymanager();
> > > >
> > > > in every SLSB method (NOT in ejbCreate) when needed? fine. I
> > > > really appreciate your help - it's quite complex to integrate
> > > > JPA into an existing Java2EE 1.4 AppServer environment.. *puh*
> > > >
> > > > regards
> > > > Hans
> > > >
> > > > -------- Original-Nachricht --------
> > > > Datum: Wed, 21 Feb 2007 08:43:20 -0800
> > > > Von: "Patrick Linskey" <pl...@bea.com>
> > > > An: open-jpa-dev@incubator.apache.org
> > > > CC:
> > > > Betreff: RE: Howto integrate JPA within EJB2.1 session beans?
> > > > [architecture]
> > > >
> > > > > Another common technique is to get an EMF into JNDI, either
> > > > by using a
> > > > > startup hook or deploying OpenJPA as a JCA RAR.
> > > > >
> > > > > Are you looking to integrate OpenJPA with your current managed
> > > > > transaction? If so, I'd be careful about creating an EM in
> > > > ejbCreate(),
> > > > > as its lifecycle is related to the life of the SLSB, 
> not to the
> > > > > transactional context (the SLSB might be pooled). So, I'd
> > > > just try to
> > > > > get the EMF into JNDI when the server starts (creating EMFs
> > > > is slow).
> > > > > Then, you could avoid having to use your own ThreadLocal
> > > > work by using
> > > > > the internal OpenJPA BrokerFactory APIs:
> > > > >
> > > > > public class PersistenceService {
> > > > >     public static EntityManager getEntityManager() {
> > > > >         EntityManagerFactory emf = OpenJPAPersistence
> > > > >             .createEntityManagerFactory(
> > > > >                 "your/EMF/JNDI/location", (Context) null);
> > > > >         BrokerFactory bf = OpenJPAPersistence.cast(emf);
> > > > >         Broker b = bf.newBroker(
> > > > >             bf.getConfiguration().getConnectionUserName(),
> > > > >             bf.getConfiguration().getConnectionPassword(),
> > > > >             true, // the broker is part of a JTA managed tx
> > > > >
> > > bf.getConfiguration().getConnectionRetainModeConstant(),
> > > > >             true); // look for an existing Broker on the tx
> > > > >
> > > > >         // do some JPA configuration setup. Logic stolen from
> > > > >         // EntityManagerFactoryImpl.
> > > > >         broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
> > > > >         
> broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
> > > > >         broker.setDetachedNew(false);
> > > > >
> > > > >         return OpenJPAPersistence.toEntityManager(b);
> > > > >     }
> > > > > }
> > > > >
> > > > > Meanwhile, we really should add a couple new 
> OpenJPAPersistence /
> > > > > OpenJPAEntityManagerFactory methods to help out with 
> this type of
> > > > > bootstrapping.
> > > > >
> > > > > -Patrick
> > > > >
> > > > > --
> > > > > Patrick Linskey
> > > > > BEA Systems, Inc.
> > > > >
> > > > >
> > > > ______________________________________________________________
> > > > _________
> > > > > Notice:  This email message, together with any attachments,
> > > > may contain
> > > > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > >  affiliated
> > > > > entities,  that may be confidential,  proprietary,
> > > > copyrighted  and/or
> > > > > legally privileged, and is intended solely for the use of
> > > > the individual
> > > > > or entity named in this message. If you are not the
> > > > intended recipient,
> > > > > and have received this message in error, please immediately
> > > > return this
> > > > > by email and then delete it.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Hans Prueller [mailto:hans.prueller@gmx.net]
> > > > > > Sent: Wednesday, February 21, 2007 1:02 AM
> > > > > > To: open-jpa-dev@incubator.apache.org
> > > > > > Subject: Howto integrate JPA within EJB2.1 session beans?
> > > > > > [architecture]
> > > > > >
> > > > > > Hi together,
> > > > > >
> > > > > > I'm sorry for bothering you with numerous basic questions
> > > > > > regarding OpenJPA and its usage but I have to migrate
> > > > > > existing CMP EJBs to migrate within short time to OpenJPA as
> > > > > > we're having stability issues with the current CMP engine.
> > > > > >
> > > > > > One last question I'd like to ask is regarding the
> > > > > > recommended architecture of using OpenJPA within EJB2.1
> > > > > > Stateless sessino beans:
> > > > > >
> > > > > > I need to work with persistence i.e. the EntityManager
> > > > > > throughout all the session beans methods so my idea is to:
> > > > > >
> > > > > > - create a EntityManagerFactory in the ejbCreate() method
> > > > of the SLSB
> > > > > > - and also create the EntityManager itself in the
> > > > > > ejbCreeate() method and store it as a member variable
> > > of the SLSB
> > > > > > - this would allow easy access within the SB's methods by
> > > > > > just using the already initialized entity manager varialbe
> > > > > > em.createNamedQuery() .. etc. etc.
> > > > > > - clean up should be performed in the ejbRemove() method
> > > > of the SLSB
> > > > > >
> > > > > > I think doing so will allow migratino to openJPA with less
> > > > > > work than doing the whole lookup procedure in every method
> > > > > > separately.
> > > > > >
> > > > > > what do you think? are there any pitfalls i've overlooked?
> > > > > >
> > > > > > thank you for your ideas!
> > > > > >
> > > > > > regards
> > > > > > Hans
> > > > > > --
> > > > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > > > Jetzt GMX ProMail testen:
> > > www.gmx.net/de/go/mailfooter/promail-out
> > > > > >
> > > >
> > > > --
> > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > Jetzt GMX ProMail testen: 
> www.gmx.net/de/go/mailfooter/promail-out
> > > >
> > >
> 
>