Hello,
i do have an embeddable component:
Code:
@Embeddable
public class TGWSample implements java.io.Serializable {
private Float sampleSize; //no of grains in sample
private Float sampleWeight; // weight of sample in gramm
private Float tgw; //thousand grain weight in gramm
[..getter and setter removed]
}
This component is integrated into several classes. Also there is a manager which calculates tgw out of sampleSize and SampleWeight.
This all works great, if and only if at least one attribute from TGWSample is not null.
My problem: The data for TGWSample should be entered by the user. So at the beginning all attributes are null.
There is an exception about
Code:
<h:inputText size="5" value="#{plot.tgwSample.sampleSize}
which states that plot.tgwSample returns null and sampleSize is not reachable.(PropertyNotFound)
According to [Java Persistence with Hibernate Page 189] a component will be mapped in the owning entity as null, when all its attributes are null. This explains the exception.
My question: how can the user enter data for suchg a component?
Of course, if there is only one entity, it could be backed by a bean (and this bean can easily create the missing component)
But i do have a datatable shown and entering data should happen inside it.
Do you know a way of achieving this?
Ciao,
Carsten