Daniel Keir Haywood created CAUSEWAY-3540:
---------------------------------------------

             Summary: 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
             Fix For: 2.0.0-RC4


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)

Reply via email to