@Embedded beans as final attribute?
<p>We are using some @Embeddable beans within some JPA Entities for better code structure and reuse. What I'm wondering is: every example I come across provides setters and getters for the @Embedded objects. Why? I tried just having them as final fields - that works, too, and makes much sense in our case, since the embedded stuff is always present. Is there some disadvantage of this that I am not aware of?</p>

<p>For example: usually it is done that way:</p>

<pre><code>@Embeddable
public class Address {
    // ...
}

@Entity
public class Person {
    @Embedded
    private Address address;

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

    public Address getAddress() {
        return address;
    }
}
</code></pre>

<p>Is there any trouble when I write <code>Person</code> this way, when there is always an <code>Address</code>:</p>

<pre><code>@Entity
public class Person {
    @Embedded
    private final Address address = new Address();

    public Address getAddress() {
        return address;
    }
}
</code></pre>