Hello
I’m looking for a solution to resolve my problem. I have 2 class: Participante and Endereco. The class
Endereco
is @Embeddable and
Participante
class use Endereco.
The problem occur when I try bindAndBuild fields of Endereco, one exception is lanced and I don’t know how to problem, because I follow example of vaadin book: [b]
9.4.5. Binding Fields to a Bean
here how I’m trying
[/b]
@Embeddable
public class Endereco {
private String endereco;
private Integer numero;
private String complemento;
private String cidade;
private String bairro;
@Enumerated(EnumType.STRING)
private EstadosDoBrasil uf;
private String cep;
public Endereco() {
super();
}
//gets and sets
@Entity
public class Participante implements Serializable{
private static final long serialVersionUID = 1L;
@Id @GeneratedValue
private Long id;
@NotNull @NotEmpty @Size(min=3, max=50)
private String nome;
@NotNull @NotEmpty @Size(min=3, max=50)
private String sobreNome;
private String sexo;
@Temporal(TemporalType.DATE)
private Date dt_nascimento;
@Temporal(TemporalType.DATE)
private Date dt_cadastro;
private String naturalidade;
private Endereco endereco;
//gets and sets
///my view with bind
BeanFieldGroup binder = new BeanFieldGroup<Participante>(Participante.class);
binder.setItemDataSource(new Participante());
Field<?> field = null;
field = binder.buildAndBind("Cidade:", "endereco.cidade", TextUpper.class);
cidade = (TextUpper)field;
cidade.setWidth("5cm");
cidade.setMaxLength(50);
mainLayout.addComponent(cidade);
//exception
Caused by: com.vaadin.data.fieldgroup.FieldGroup$BindException: Property type for 'endereco.cidade' could not be determined. No property with that id was found.
at com.vaadin.data.fieldgroup.FieldGroup.getPropertyType(FieldGroup.java:369)
at com.vaadin.data.fieldgroup.BeanFieldGroup.getPropertyType(BeanFieldGroup.java:42)
at com.vaadin.data.fieldgroup.FieldGroup.buildAndBind(FieldGroup.java:1037)
at br.com.webapp.views.ParticipanteForm.bindingFields(ParticipanteForm.java:163)
at br.com.webapp.views.ParticipanteForm.insert(ParticipanteForm.java:91)
at br.com.webapp.views.ParticipanteView.buttonClick(ParticipanteView.java:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
... 40 more
How to I do this ?