isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cesar Lugo <>
Subject RE: Compuond objects
Date Thu, 05 Nov 2015 17:21:12 GMT
In most cases I would prefer the second choice (view models), because I want all domain logic
to be applied to the corresponding objects within the view if it gets updated or inserted,
which won't happen if I use database views. 

I will try to find some example in Estatio. I don’t think I understood your last statement
about view models and collections, perhaps I will when I dig a little more into this.


-----Original Message-----
From: Dan Haywood [] 
Sent: Thursday, November 5, 2015 10:43 AM
To: users
Subject: Re: Compuond objects

It is possible to map java domain classes to views instead of tables.

Estatio has a couple of examples... perhaps Jeroen could dig out a link for you (I'm typing
this on my phone).

Alternatively, yes, you could use view models. These then programmatically combine the data.

On your particular use case I would inject the repositories for the "backing entities".

One point to beat in mind is that Isis will handle view models with collections, it only serializes
the state of the view model's properties (the determine the url of the view model). The workaround
is to make the collection derived, using @Collection(notPersisted=true), and return is results
by requerying the appropriate repository.

Again, Estatio has some examples, I think

On 5 Nov 2015 15:16, "Cesar Lugo" <> wrote:

> Hello. I have the need to create some objects that are compound from 
> some other domain objects (similar to a "view" in a relational 
> database, updatable views). Let's say I have Business with businessId 
> and name properties, 1:n to another entity named BusinessLocation with 
> properties businessLocationId and name and address properties (to keep 
> things simple for now). So, for example, I need to create a new object 
> that is BuisinessLocationView, which contains, 
>, and . Then, in some 
> cases, I want to use such views like BusinessLocationView as a 
> collection within Business, and as a standalone collection, and also 
> have the ability to update its fields so the corresponding entities 
> are updated with the changes (Business and BusinessLocation), and in 
> some cases even add a new view like BusinessLocationView so it adds a 
> new BusinessLocation.
> Is there a way to do this? Is that what @ViewModel is for?
> I would appreciate If you could point me to any sample that might help.
> Cesar.
> ---
> This email has been checked for viruses by Avast antivirus software.

This email has been checked for viruses by Avast antivirus software.

View raw message