pojo inside the pojo using bean item

hi,
i am new to vaadin, i am doing the simple example of inserting the data into the table.
for that i implemented one pojo which has a reference of other pojo. i am using the soap based web services and hibernate for that.
but data is not updated when pojo reference is set as a property.

i tried it using addNestedProperty method to the bean-Item, but not works.

cloud anyone pls help me how to do that or one example of that.

The pojo’s are…

public abstract class AbstractCatCatalogue implements java.io.Serializable {

// Fields

private Integer catalogueId;
private CatCatalogueStatuses catCatalogueStatuses;
private CatCatalogueType catCatalogueType;
private String name;
private String description;
private Integer ownerEntityId;
private Date createdOnDate;
private Integer createdByUserId;
private Date changedOnDate;
private Integer changedByUserId;
private Integer journalId;

//setters and gettters

public abstract class AbstractCatCatalogueStatuses implements java.io.Serializable {

// Fields

private Integer statusId;
private String name;
private String description;

//setters and getters

public abstract class AbstractCatCatalogueType implements java.io.Serializable {

// Fields

private static final long serialVersionUID = -3342558052959737219L;
private Integer typeId;
private String name;
private String description;

//setters and getters

how can i insert the record of AbstractCatCatalogue record into the database.

Thanks in advance.

Can you be more specific? Using nested properties should work, provided the Entity references (AbstractCatCatalogue → AbstractCatCatalogueStatuses) on the way are non-null. What did you try to bind?

Thanks for the reply. I will go more specific on this.I am using vaadin 7.
basically what i have done…

CatCatalogue catalog=new CatCatalogue();

BeanItem bean=new BeanItem(catalog);

final Property property1=bean.getItemProperty(“name”);
final Property property2=bean.getItemProperty(“catCatalogueStatuses.statusId”);
final Property property4=bean.getItemProperty(“catCatalogueType.typeId”);

for status selection i have taken one combo-box with bean item container>>

final BeanItemContainer beans3 =
new BeanItemContainer(CatCatalogueStatuses.class);

for (CatCatalogueStatuses catalogueStatus :status.loadCatalogStatusFromWS()){

         beans3.addBean(catalogueStatus);
       		}
    
final ComboBox satsus=new ComboBox("",beans3);
 satsus.setImmediate(true);

satsus.setPropertyDataSource(property2);

satsus.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ID);
satsus.setItemCaptionPropertyId("name");

and for type selection >>

final BeanItemContainer beans2 =
new BeanItemContainer(CatCatalogueType.class);

for (CatCatalogueType catalogue :type.loadCatalogTypeFromWS()){

  beans2.addItem(catalogue);
			
}
    
    
    
final ComboBox type=new ComboBox("",beans2);

type.setPropertyDataSource(property4);
   
 type.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ID)
 type.setItemCaptionPropertyId("name")

for insertion i was calling hibernate function>>

        cat.save(catalog);

firstly it shows conversion exception that CatCatalogueWSStub.CatCatalogueStatuses is not the type of CatCatalogestatusesWSStub.CatCatalogueStatuses.

and it shows error of catCatalogueStatuses and catCatalogueType as null on console.

i think we have to write custom convert for this i tried it but, not works with combobox. please let me know is there any demo
code on this.

i tried lot on it but , unfortunately not works.
suggest any solution on this.

Thanks/

One thing I noticed right away is that you are not calling the method BeanItem.addNestedProperty(). You need to call this before calling any ‘xx.yy’ properties.

Thanks for reply.
but when i call BeanItem.addNestedProperty() over the combobox, it gives error of com.vaadin.data.Buffered$SourceException at runtime.
why does it gives this exeception.

You need to look deeper, at the cause for that Exception. Maybe a nullpointer when trying to access the nested property?