alejandro-du / crudui

Automatically generate CRUD-like Vaadin views for any Java Bean
https://vaadin.com/directory#!addon/crud-ui-add-on
Apache License 2.0
85 stars 54 forks source link

Add/Edit operation does not display the fields in the form #115

Closed jainsumitt closed 1 year ago

jainsumitt commented 1 year ago

Hi Alejandro. First of all, Thank you for developing this add-on, it made it very easy.

I have 2 pojo classes Order and OrderItemDetails.

@Entity
@Table(name = "orders")
public class Order {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long orderId;

    private String customerName;
    private String firmName;

    @ManyToMany(cascade = CascadeType.ALL, targetEntity = OrderItemDetail.class)
    @Fetch(FetchMode.JOIN)
    @JoinColumn(name = "order_id")
    private Set<OrderItemDetail> itemDetails = new HashSet<>();
}
@Entity
public class OrderItemDetail {

    @javax.persistence.Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long itemDetailsId;

    private String itemName;
    private Double itemQuantity;
}

When I try to add field to the view or grid, the properties from OrderItemDetail does not show up.

crud.getCrudFormFactory().setVisibleProperties(
                CrudOperation.ADD,
                "customerName", "firmName", "orderTotalAmount", "orderDiscount",
                "orderFinalAmount", "amountPaid", "amountCredit", "orderComments",**"itemName"**);

Also

crud.getCrudFormFactory().setFieldProvider(**"itemName"**,
                new ComboBoxProvider<>(service.findAllItemNames()));

I don't seems to get these field spin the form.

alejandro-du commented 1 year ago

Does your entity have mutators?

jainsumitt commented 1 year ago

Yes, I am using Lombok library

alejandro-du commented 1 year ago

I can't reproduce this. Check that you have a getter and setter for the offending property.

alejandro-du commented 1 year ago

Please feel free to reopen and provide more information if the issue persists.