|Using database views [message #386013]
||Wed, 18 March 2009 17:57
|| Elvis Dominguez
Registered: July 2009
sorry for the maybe obvious response to this question, and sorry for my
Hi have a project (DB <--> JBoss <--> RCP), with let's say, 4 domain
objects and relative daos.
@Entity Article (FK to Store)
@Entity AuthorizedArticles (FK to Customer and Articles, plus other
Now I would like to display in a TableViewer Articles loaded from
AuthorizedArticles table. Let's say a table containing Article.code,
Article.description and Article.defaultStore.description.
To display such data in a TableViewer the JPA/db 's load is very high due
to joins, lazy loading and whatever (= slow performances)
Now, to avoid such load and bad performances I had the idea to create a
DATABASE VIEW, let's say AuthArticlesView, containing my 3 display fields.
I have created an @Entity and bind to this VIEW.
The performances increase was absolutely a joy (load time on the client
from 700 ms to 30 ms).
But now I would like to know what are the consequences of this «trick» or
better said «dirty approach».
Or better understand what is the correct approach.
Maybe native query with SqlResultSetMapping? over table or view?
Examples? (i can't foind a decent one on the net)
Isn't there a native support to views? Why?
I have tried implementing DTO but the performances aren't much better as
the original try.
Hope someone can clarify my doubts... Thanks!
Powered by FUDForum
. Page generated in 0.04330 seconds