Spring-Data-JPA Container

Hi,

I’d like to crate a container for Spring-Data-JPA respository. My main goal is to also use it with FilteringTable addon for Filtering & Paging table usinf JPA Repositories Paging and JPA Predicate features.

Can someone give me a starting point so I can contribute with this addon…

Thanks

Have you seen JPAContainer? https://vaadin.com/book/-/page/jpacontainer.html

If that isn’t what you need, maybe you could be specific about what you are trying to accomplish that’s different.

Hi Matthew,

Sory for the late response.

I see the JPA container, its good & usefull. but we’re generally developing application with spring & everything, datasource, transaction etc, managed by spring. I dont have a connection pool in my habd, I can acces but why ?, I dont have persistence.xml file, all these are spring managed. So basicly I’m coding the business as simple as I can.

spring data jpa, http://docs.spring.io/spring-data/jpa/docs/1.7.1.RELEASE/reference/html/, has methods to get the data as Pages or Slices so If I have a container to understand these consepts, Page or Slice, than it can automatically request the next page and request it from DB.

Also, there are some work on your side to integrate Spring Boot and vaadin, https://github.com/peholmst/vaadin4spring, so I believe this is or will be an important feature.

All I need is a starting point about developing my own Container than I can contribute it as an addon.

Interesting-- thanks for the response.

(As an aside, I actually have phased JPAContainer out of my project in recent weeks. I was mostly using FreeformQery anyway, and in the few remaining places I had two or three mutualy dependent JPAContainers that had to be reread when the user made a selection from any of them. It made more sense to read all the joined data up front with one query.)

So, to your original question. I’m fairly new to this stuff myself, but I suspect it would be easier to use the standard SQLContainer and instead implement your own QueryDelegate. The interface has methods like getCount and getResults (with optional paging) and filtering. Then you can simply construct a standard SQLContainer using your QueryDelegate, and FilterTable should work out of the box with it.

Hi,

Check out
LazyQueryContainer
. It should be pretty easy to use that to create a container that just calls appropriate methods form your spring data jpa service.

I’m personally not that big fan for the Filterable API in Container. I’d like it more if I could just hook to “filtering changed listener” to the Table and there fetch an new list of entities via the service (and pass that to Table). I added
an enhancment ticket
to my Maddon helper libary about this.

cheers,
matti