SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: JPA Eclipselink GPS Indexing with multiple Persistence Units

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Pages: 1 - Last Post: Oct 15, 2009 6:23 AM Last Post By: Vackar Afzal
Vackar Afzal

Posts: 2
Registered: 9/30/09
JPA Eclipselink GPS Indexing with multiple Persistence Units
Posted: Oct 14, 2009 11:08 AM
 
  Click to reply to this thread Reply
Hi,

I have a JPA (EclipseLink) project with 2 persistence units (Pu1 and Pu2) and I have entities marked as searchable for each persistence unit.

When I run


CompassGps gps = EclipseLinkHelper.getCompassGps("Pu1");
gps.index();


It attempts to index entities managed by Pu1 and Pu2.

Does anyone know why? And does anyone know how to get around this issue?

Thanks,
Vackar
Vackar Afzal

Posts: 2
Registered: 9/30/09
Re: JPA Eclipselink GPS Indexing with multiple Persistence Units
Posted: Oct 15, 2009 6:23 AM   in response to: Vackar Afzal in response to: Vackar Afzal
 
  Click to reply to this thread Reply
OK, I had a look through the source and the index method re-indexes everything marked as searchable, and not just the entities manager by the EntityManager manager - as I had previously believed.

The entity manger is simply a way of getting the data to be indexed.

For future reference, the solution was to pass the Root searchable classes to be indexed to the index method.

i.e.

gps.index(getClassesManagerBy("nameOfPu"))
...
...

public Class [] getClassesManagerBy(String puName){
if(puName.equals(...)
return new Class [] {Root1.class, Root2.class, Root3.class};
else
....
}
Legend
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums