Gemini JPA EntityManagerFactoryBuilder [message #695231] |
Mon, 11 July 2011 10:32 |
|
Hi,
I'm implementing a scenario where multiple bundles contribute JPA
entities but do not specify database connection settings in their
persistence.xml. The database connection settings are configured at
runtime. According to the spec I should be able to implement this using
the EntityManagerFactoryBuilder service.
Does Gemini JPA implement an EntityManagerFactoryBuilder service?
-Gunnar
--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
|
|
|
|
Re: Gemini JPA EntityManagerFactoryBuilder [message #695447 is a reply to message #695296] |
Mon, 11 July 2011 18:57 |
|
Hi Mike,
Am 11.07.2011 15:09, schrieb Mike Keith:
> Gemini JPA implements all of the OSGi JPA spec, including the EMFBuilder service.
That's good to know. Thanks! Thus, I must be missing some bundle in my
workspace. I have EclipseLink in my target platform and Gemini JPA
checked out from SVN (uncluding osgi.enterprise).
However, I can't find any implementation of EMFBuilder. When I run my
tests I don't get a service reference.
> However, the OSGi JPA spec dictates that all entities for a single
> persistence unit must be in the same bundle so that restriction is in
> effect in Gemini JPA.
Do you know if it's possible to re-use/share the EclipseLink connection
pool between different PUs?
-Gunnar
--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
|
|
|
Re: Gemini JPA EntityManagerFactoryBuilder [message #696706 is a reply to message #695447] |
Thu, 14 July 2011 16:30 |
Shaun Smith Messages: 197 Registered: July 2009 |
Senior Member |
|
|
Hi Gunnar,
On 11/07/2011 2:57 PM, Gunnar Wagenknecht wrote:
> Hi Mike,
>
> Am 11.07.2011 15:09, schrieb Mike Keith:
>> Gemini JPA implements all of the OSGi JPA spec, including the EMFBuilder service.
>
> That's good to know. Thanks! Thus, I must be missing some bundle in my
> workspace. I have EclipseLink in my target platform and Gemini JPA
> checked out from SVN (uncluding osgi.enterprise).
>
> However, I can't find any implementation of EMFBuilder. When I run my
> tests I don't get a service reference.
>
It looks like the class is indeed missing. Mike's traveling so I
can't consult him on this but it looks like an error in the generation
of the downloadable zip. EMFBuilder is a spec class that's picked up
from the OSGi alliance and re-packaged in Gemini JPA. All of the OSGi
enterprise spec classes are in the Gemini JPA SVN repo in the
osgi.enterprise project. So if you take the osgi.enterprise.jar from
that project and deploy it along with the Gemini JPA bundles you should
be okay as a workaround.
>> However, the OSGi JPA spec dictates that all entities for a single
>> persistence unit must be in the same bundle so that restriction is in
>> effect in Gemini JPA.
>
> Do you know if it's possible to re-use/share the EclipseLink connection
> pool between different PUs?
Out of the box, each PU has it's own connection pool. Which makes sense
since the user/password for each PU may be different. EclipseLink has
support for using an "external" connection pool when running in a Java
EE container I'm not sure how this would fit with the OSGi JPA spec.
Shaun
>
> -Gunnar
>
>
--
Oracle <http://www.oracle.com>
Shaun Smith | Principal Product Manager
Phone: +1.905.502.3094 | Mobile: +1.416.558.6244
Oracle Fusion Middleware, TopLink
ORACLE Canada | 100 Milverton Drive, Mississauga, Ontario | L5R 4H1
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment
|
|
|
Re: Gemini JPA EntityManagerFactoryBuilder [message #696764 is a reply to message #696706] |
Thu, 14 July 2011 19:22 |
|
Hi Shaun,
Am 14.07.2011 18:30, schrieb Shaun Smith:
>> However, I can't find any implementation of EMFBuilder. When I run my
>> tests I don't get a service reference.
>>
>
> It looks like the class is indeed missing.
I think I found it. Gemini generates a dynamic proxy. That's why there
is no implementation for it. However, looking at the proxy I think I've
made some mis-assumptions about how EMFBuilder works.
> Out of the box, each PU has it's own connection pool. Which makes sense
> since the user/password for each PU may be different.
Right. I'm trying to implement a different use-case. So maybe Gemini is
not what I'm looking for.
I'd like to implement an OSGi service which allows to programmatically
register entity classes. Then I'd like to use the entities with
different data sources / connection pools (different catalogs/schema) at
runtime.
Sounds like I want to dynamically create PUs at runtime. Is that
possible with EclipseLink?
-Gunar
--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
|
|
|
Re: Gemini JPA EntityManagerFactoryBuilder [message #696790 is a reply to message #696764] |
Thu, 14 July 2011 20:08 |
Shaun Smith Messages: 197 Registered: July 2009 |
Senior Member |
|
|
On 14/07/2011 3:22 PM, Gunnar Wagenknecht wrote:
> Hi Shaun,
>
> Am 14.07.2011 18:30, schrieb Shaun Smith:
>>> However, I can't find any implementation of EMFBuilder. When I run my
>>> tests I don't get a service reference.
>>>
>>
>> It looks like the class is indeed missing.
>
> I think I found it. Gemini generates a dynamic proxy. That's why there
> is no implementation for it. However, looking at the proxy I think I've
> made some mis-assumptions about how EMFBuilder works.
Ah, I thought you were missing the actual EMFBuilder spec class.
>
>> Out of the box, each PU has it's own connection pool. Which makes sense
>> since the user/password for each PU may be different.
>
> Right. I'm trying to implement a different use-case. So maybe Gemini is
> not what I'm looking for.
>
> I'd like to implement an OSGi service which allows to programmatically
> register entity classes. Then I'd like to use the entities with
> different data sources / connection pools (different catalogs/schema) at
> runtime.
>
> Sounds like I want to dynamically create PUs at runtime. Is that
> possible with EclipseLink?
The JPA and OSGi JPA specs don't cover dynamic/on the fly definition of
persistence units but it is possible with EclipseLink. Much of Gemini
JPA is concerned with the detection of persistence unit bundles,
locating the requested datasource, and publishing services. This all
assumes that all classes and JPA metadata are contained in deployed
bundles. This doesn't sound like your situation. It *should* be
possible to build support for what you're looking for (at least what I
think you're looking for) with EclipseLink but it would not be trivial.
Shaun
>
> -Gunar
>
--
Oracle <http://www.oracle.com>
Shaun Smith | Principal Product Manager
Phone: +1.905.502.3094 | Mobile: +1.416.558.6244
Oracle Fusion Middleware, TopLink
ORACLE Canada | 100 Milverton Drive, Mississauga, Ontario | L5R 4H1
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment
|
|
|
Powered by
FUDForum. Page generated in 0.02659 seconds