[Gemini JPA] How would be the best way to implement fetch pagination in a OSGi Persistence service [message #820870] |
Wed, 14 March 2012 13:20  |
Eclipse User |
|
|
|
Hi,
In my actual project I've concentrate the entity classes in the persistence bundle. Then, I've created some other bundles that is referencing the EMF service and exposing some business services interfaces.
Now I would like to improve the data visualization performance using data pagination to get data lazily.
I would like to hear any comments about this kind of implementation in a OSGi service context.
What kind of info should I pass in the service method to allow me to do this ?
thanks for any comment,
regards,
Cristiano
|
|
|
|
Re: [Gemini JPA] How would be the best way to implement fetch pagination in a OSGi Persistence servi [message #826829 is a reply to message #821690] |
Thu, 22 March 2012 10:56   |
Eclipse User |
|
|
|
Hi Mike,
I should say that you were right. There are lot of ways to implement what I wanted to...
And I ended creating some generic interface, like the one below, that help me to create both mock and real implementations easily using Declarative Services:
public interface LazyQueryService<RootEntity> {
List<RootEntity> fetchWithFilter(Map<String, Object> queryFilter,
Object[] sortPropertyIds, boolean[] sortStates, int startIndex,
int fetchSize);
int fetchSizeWithFilter(Map<String, Object> queryFilter);
void save(List<RootEntity> addedObjects, List<RootEntity> modifiedObjects,
List<RootEntity> removedObjects);
}
cheers,
Cristiano
|
|
|
Re: [Gemini JPA] How would be the best way to implement fetch pagination in a OSGi Persistence servi [message #832806 is a reply to message #826829] |
Fri, 30 March 2012 12:03   |
Eclipse User |
|
|
|
Hi Cristiano.
In some cases, I belive this approach will cause you to implement more methods on your services than you need. Here, when I use a ORM Service, I expose the EntityManager of this service to a specialized component on my views, that can Handle it, and paginate automatically paginate entities. This component uses Criteria, so, you can pass a RootQuery (wen you need filters), and it will handle automatically the pagination, ordering, etc.
|
|
|
Re: [Gemini JPA] How would be the best way to implement fetch pagination in a OSGi Persistence servi [message #835119 is a reply to message #832806] |
Mon, 02 April 2012 16:32  |
Eclipse User |
|
|
|
Hi Eduardo,
Expose the EntityManager in my case would be a kind difficult just because my services will be accessed by two types of osgi applications: a E4 RCP and an Osgi Web, using asynchronous remote method calls supported by the remote services of ECF.
To easy my life I've created an abstract class that implemented the interface that I've show before and some other common protected methods and the EntityManager is injected in an attribute of it. So, all specialized concrete classes implements its own interfaces(business oriented) and inherit from this abstract class.
regards and thanks for suggestion,
Cristiano
|
|
|
Powered by
FUDForum. Page generated in 0.11345 seconds