openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthieu Riou" <matthieu.r...@gmail.com>
Subject Re: Configuration: either / or ?
Date Wed, 03 Jan 2007 22:28:21 GMT
My ultimate goal is to provide directly an instance of DataSource that
OpenJPA would use instead of trying to lookup or create one. It seems that
it's possible by setting ConnectionFactory to the datasource instance but
OpenJPA fails before that if no ConnectionDriverName is specified.

Abe is right when saying that I should provide the properties to
createEntityManager insteand of createEntityManagerFactory but I still can't
find to way to initialize everything property.

Thanks,

Matthieu

On 1/3/07, Marc Prud'hommeaux <mprudhom@apache.org> wrote:
>
> Matthieu-
>
> Can you send the complete stack trace?
>
> Also, I don't think this is the cause of the problem, but why are you
> specifying both ConnectionDriverName and ConnectionFactory? With
> ConnectionFactory specified, you shouldn't need to specify the
> ConnectionDriverName.
>
>
>
> On Jan 3, 2007, at 5:01 PM, Matthieu Riou wrote:
>
> > Sorry I've jumped too quickly to conclusions. The mistake was mine.
> >
> > However I'm trying to initialize OpenJPA programmatically using the
> > following code:
> >
> >        HashMap propMap = new HashMap();
> >        propMap.put("openjpa.ManagedRuntime", new TxMgrProvider
> > (_txMgr));
> >        propMap.put("openjpa.ConnectionDriverName",
> > org.apache.derby.jdbc.EmbeddedDriver.class.getName());
> >        propMap.put("openjpa.ConnectionFactory", _datasource);
> >        EntityManagerFactory emf =
> > Persistence.createEntityManagerFactory("ode-dao",
> > propMap);
> >        EntityManager em = emf.createEntityManager(propMap);
> >
> > The TxMgrProvider implements the ManagedRuntime interface.
> >
> > When execute, for each of the Map key I'm passing I'm getting:
> >
> > <4|false|0.9.6-incubating-SNAPSHOT>
> > org.apache.openjpa.persistence.ArgumentException: Missing getter for
> > property "ConnectionDriverName" in type "class
> > org.apache.openjpa.persistence.EntityManagerImpl".
> >
> > With the NoSuchMethodException that comes together. As I'm passing
> > configuration properties I don't get why it tries to set of get
> > them on the
> > entity manager. I guess I'm doing something wrong, do you have an
> > idea of
> > what could that be?
> >
> > Thanks!
> >
> > Matthieu
> >
> > On 1/3/07, Abe White <awhite@bea.com> wrote:
> >>
> >> > I've been fighting for some time now with my OpenJPA configuration
> >> > and just
> >> > discovered why. It seems that you *either* consider the
> >> > persistence.xml file
> >> > *or* the map passed as parameter of
> >> > Persistence.createEntityManagerFactory.
> >> > If you look at PersistenceProductDerivation.load(String rsrc,
> >> > String name,
> >> > Map m) (line 151), if the configuration provider can find a
> >> > configuration
> >> > file then the configuration is returned as is and the provided
> >> > configuration
> >> > Map doesn't even gets considered.
> >>
> >> I don't see this.  The Map is passed along to the method that loads
> >> the configuration file, which passes it along to the configuration
> >> parser, which sets its entries over the properties it parses.
> >> _____________________________________________________________________
> >> __
> >> 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.
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message