[forge-dev] Auto instantiate properties of custom type

Richard Kennard richard at kennardconsulting.com
Tue Nov 8 23:37:35 EST 2011


Hi guys,

As you're probably aware, in JSF if I do...

    #{customer}

...then a Customer object will get instantiated 'just in time'. But if I do...

    #{customer.address.street}

...then 'address' will *not* get instantiated just in time. So if you use Forge to do...

    entity --named Customer
    field custom --named address
    [what custom type m'lord?] com.test.domain.Address

Then although you'll get a UI that includes a Customer with an embedded Address, it'll fail as soon as you try to save. There isn't a very good solution to
this, so can I suggest the simplest?

When Forge generates field/getter/setter for a custom type (possibly limited to the project's domain package), could it do:

    @Column
    private Address address *=new Address();*

    public Address getAddress() {
        return this.address;
    }

    public void setAddress(final Address address) {
        this.address = address;
    } }



More information about the forge-dev mailing list