Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

A tip: If you want to use TableQuery with a DB view...

Dino Fancellu
7 years ago Jun 09, 2015 5:01pm

If you try, because views don't have PKs and TableQuery demands it, in fetchMetaData(), it will barf

A solution is to clone TableQuery, then make fetchMetaData public

then when calling (I'm using Scaladin BTW)

val tq=new mine.TableQuery("userordersview",AdminUI.pool){
      override def fetchMetaData()={
       primaryKeyColumns=List("ID").asJava        
       super.fetchMetaData()
      } 

Its a pity TableQuery.fetchMetaData() is private, as there would be no need to create own copy. Would be nice if they could change it.

And why would I want to use a view inside a TableQuery? So that I can have a complex read only query, without having to use FreeFormQuery, which lacks sorting/filtering

 

Marius Reinwald
7 years ago Jun 10, 2015 12:20pm
Dino Fancellu
7 years ago Jun 10, 2015 12:25pm
Thorsten Pottiez
7 years ago Aug 17, 2015 8:15am
Marius Reinwald
7 years ago Aug 17, 2015 8:38am
Thorsten Pottiez
7 years ago Aug 17, 2015 9:26am
Marius Reinwald
7 years ago Aug 17, 2015 9:37am
Thorsten Pottiez
7 years ago Aug 17, 2015 11:09am
Marius Reinwald
7 years ago Aug 17, 2015 11:17am
Thorsten Pottiez
7 years ago Aug 17, 2015 1:09pm
Marius Reinwald
7 years ago Aug 17, 2015 1:34pm
Thorsten Pottiez
7 years ago Aug 17, 2015 1:37pm
Marius Reinwald
7 years ago Aug 17, 2015 2:16pm