Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Horizontal partitions/Shards with EclipseLinks and JPA 2.0
Horizontal partitions/Shards with EclipseLinks and JPA 2.0 [message #387926] Mon, 18 May 2009 14:35 Go to next message
Ryan de Laplante is currently offline Ryan de LaplanteFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

Does EclipseLink have anything similar to Hibernate Shards for horizontal
partitioning? Can this feature be used along with JPA 2.0 annotations and
configuration?

If no, does anyone know if Hibernate Shards can be used with Hibernate
EntityManager (JPA annotations)?


Also, does EclipseLink have anything similar to Hibernate Search which
wraps Apache Lucene?


Thanks,
Ryan
Re: Horizontal partitions/Shards with EclipseLinks and JPA 2.0 [message #387953 is a reply to message #387926] Tue, 19 May 2009 20:07 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I'm not very familiar with Hibernate Shards or Search, but Shards seems
similar to EclipseLink's SessionBroker feature, so you may wish to
investigate that. SessionBroker allows you to access multiple different
databases from a single EclipseLink Session.
What are your specific requirements?

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Re: Horizontal partitions/Shards with EclipseLinks and JPA 2.0 [message #388112 is a reply to message #387953] Sun, 24 May 2009 22:31 Go to previous messageGo to next message
Ryan de Laplante is currently offline Ryan de LaplanteFriend
Messages: 3
Registered: July 2009
Junior Member
Thanks for the info. I will look into SessionBroker. I'm looking at ways
to develop a multi-tenant app that use a separate schema for each tenant.
I don't want to have a new connection pool for each tenant and want to
keep it efficient.

I recently read that Hibernate Shards is not appropriate for large numbers
of schemas because it creates one SessionFactory per. Instead I could
consider intercepting every statement preparation and modifying it to use
the schema of the currently logged in user.

Thanks,
Ryan
Re: Horizontal partitions/Shards with EclipseLinks and JPA 2.0 [message #388120 is a reply to message #388112] Mon, 25 May 2009 17:49 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

In EclipseLink you can use a different user login when you create an
EntityManager. This may be all you need, if you just want to use a
different schema for each user. Just have the user default to their
schema, and provide the user when creating the EntityManager in the
properties map. You will also need to disable the shared cache.

See, EntityManagerProperties in config for a list of properties you can
pass when creating an EntityManager.


James : Wiki : Book : Blog : Twitter
Re: Horizontal partitions/Shards with EclipseLinks and JPA 2.0 [message #388422 is a reply to message #388120] Mon, 25 May 2009 17:59 Go to previous messageGo to next message
Ryan de Laplante is currently offline Ryan de LaplanteFriend
Messages: 3
Registered: July 2009
Junior Member
Thanks for the reply. I think this will not be suitable for my
application for the same reason Hibernate Shards will not be. I do not
want to create separate connection pools for hundreds or thousands of
customers, each with dozens of connections in the pool. I will figure
something else out. What I really want to do is have one connection pool
connected to the database with a user that has access to all schemas, and
be able to tell JPA which schema to use each time it does queries. For
example, SELECT * FROM tenantA.Accounts and later SELECT * FROM
tenantB.Accounts
Re: Horizontal partitions/Shards with EclipseLinks and JPA 2.0 [message #388430 is a reply to message #388422] Tue, 26 May 2009 13:27 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You don't need to use connection pools. You can just connect a new JDBC
connection for each EntityManager with the user login. If you have any
shared data, then you can use a shared connection pool for that and enable
caching for those classes.


James : Wiki : Book : Blog : Twitter
Previous Topic:JPQL and Spatial Queries
Next Topic:null in or part of where clause
Goto Forum:
  


Current Time: Thu Apr 25 16:31:07 GMT 2024

Powered by FUDForum. Page generated in 0.03913 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top