|
|
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 14:56 |
Cristiano Gavião Messages: 279 Registered: July 2009 |
Senior Member |
|
|
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 16:03 |
Eduardo Frazão Messages: 123 Registered: January 2012 |
Senior Member |
|
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03187 seconds