Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hbase, multiple tables #641

Closed
fe2s opened this issue Sep 3, 2014 · 6 comments
Closed

Hbase, multiple tables #641

fe2s opened this issue Sep 3, 2014 · 6 comments
Labels

Comments

@fe2s
Copy link

fe2s commented Sep 3, 2014

I've got 50 jpa entities that I want to persist to 50 different Hbase tables. It looks like the only option is to create a peristence unit per entity since in Kundera Hbase table is mapped to keyspace. There are several issues:

  1. this is very inconvenient. Persistence.xml becomes large and contains 50 almost copy pasted blocks.
  2. I have to create 50 EnityManagers where each manager works with its own entity class
  3. I guess having 50 EntityManagers implies keeping 50 connection pools to the same Hbase instance. This is a waste of resources and performance problem.
@chhavigangwal
Copy link
Collaborator

@fe2s

For issue#1 , you can create one pu and set its keyspace while creating EMF by setting them in external property map :

  Map<String, String> puProperties = new HashMap<String, String>();
  puProperties.put("kundera.keyspace", "KunderaHbaseKeyspace");
  emf = Persistence.createEntityManagerFactory(_PU, puProperties);

For issue#2 and issue#3, I acknowledge it is an issue with Kundera and team will be working on resolving the same.

Thanks,
Chhavi

@gcastigl
Copy link

Hi, are there any updates on this? any workaround?

Thanks in advance!

@fnmartinez
Copy link

Hi! I'm having this exact same issue. I'd like to be able to have N tables, one per entity, and manage them all with one entity manager. Has there been any progress with these? Is there any workaround I might be missing?

Te most important question would be if every EntityManager spawned would effectively imply a new connection.

Thanks in advance!

@chhavigangwal
Copy link
Collaborator

Fixed with Kundera -2.16 release.

@hegdeaditya
Copy link

Hi, can anyone please specify how to map different entities to different tables, post fixing of this issue, without creating different persistence units.

@devender-yadav
Copy link
Contributor

@hegdeaditya

You should use kundera-hbase-v2

<dependency>
     <groupId>com.impetus.kundera.client</groupId>
     <artifactId>kundera-hbase-v2</artifactId>
     <version>${kundera.version}</version>
</dependency>

In this, different entity is mapped with different hTable similar to RDBMS (entity mapped with table)

Check wiki for details.

-Dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants