s.grinovero wrote:
Quote:
Excuse me but maybe I didn't express my question correctly ...
Ah, sorry.
Well that's tricky; ...
What you can do is make sure the second level cache of Hibernate is involved: ...
Thank you now I understand. Unfortunately the persistence layer of the application is not developer with Hibernate (no Java at all, it's a COBOL app), so I can't use caches so I have to find a way to use projections.
Quote:
About your primary question, I understand and you're welcome to do as is more practical for you. Just one observation: if you where to make a SQL view, you would likely want to define some common column names for the resultset. Or just to present the list to the user, if you present it all mixed in a single table, what are the column names going to be?
Sorry I forgot to specify that I would define a mapping layer: for every involved physical table I would define somewhere how the real columns are mapped to the view's columns, e.g. if TABLE1 has two key fields PKFIELD1 and PKFIELD2 then I write somewhere the name of the fields, their lengths, ...
Quote:
It looks like to me you want to actually present to the final user three different resultsets, then you should make three different queries and show each kind of result in it's more appropriate representation. This isn't much a technical question anymore, but think about user experience looking at your data.
Yes I want to query different domains (that the user can select) but I want to present a single result, e.g. if I search ACME then I want to present a single list with invoices, orders, accounts, ... that have ACME in their text fields (descriptions of items, accounts, firm names, ...). So the list, ordered by relevance, would be something like
Order JO0001 for customer ACME inc.
Purchase invoice JI022289 for Italian ACME ltd.
Purchase invoice JI022290 for Italian ACME ltd.
Account FA00001: ACME inc.
...
Now it's clear to me that the SQL view (with the mapping layer) can solve my problems (otherwise I should merge the results of the different queries). I will check ResultTransformers, thank you.
Thank you very much for your support Sanne!
All the best,
Andrea