You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@causeway.apache.org by "Daniel Keir Haywood (Jira)" <ji...@apache.org> on 2024/06/01 15:04:00 UTC

[jira] [Updated] (CAUSEWAY-3540) Mixin property annotated using @Property(projecting=...) not picked up in the MM.

     [ https://issues.apache.org/jira/browse/CAUSEWAY-3540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Keir Haywood updated CAUSEWAY-3540:
------------------------------------------
    Fix Version/s:     (was: 2.1.0)

> Mixin property annotated using @Property(projecting=...) not picked up in the MM.
> ---------------------------------------------------------------------------------
>
>                 Key: CAUSEWAY-3540
>                 URL: https://issues.apache.org/jira/browse/CAUSEWAY-3540
>             Project: Causeway
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-RC2
>            Reporter: Daniel Keir Haywood
>            Priority: Minor
>
> The use case is that I had an entity (OutgoingInvoice) and also a view model (OutgoingInvoiceView), with the view model being based on the entity but having more information.
> What I wanted to do was have a query return a list of entities (because that is very fast, avoids the n+1 orm problem), but then when the user clicks on an entity icon from the list, then to open up the view instead.
> This works fine if I declare the "projecting" property as a regular property on the entity:
> {code:java}
> @Property(projecting = Projecting.PROJECTED)
> @PropertyLayout(hidden = Where.EVERYWHERE)
> public OutgoingInvoiceView getView() {
>     return new OutgoingInvoiceView(this);
> }{code}
> However, this makes the entity (dom layer) aware of the view (app layer), which I didn't much like.  So I wanted instead to have a mixin in the app layer contribute to the entity ... but it doesn't get picked up:
> {code:java}
> @Property(projecting = Projecting.PROJECTED)
> @PropertyLayout(hidden = Where.EVERYWHERE)
> @RequiredArgsConstructor
> public static class view() {
>     private final OutgoingInvoice entity;
>     @MemberSupport public OutgoingInvoiceView prop() {
>         return new OutgoingInvoiceView(entity);
>     }
> }{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)