JPA relationship JPAContainer with ComboBox?

前端 未结 2 1491
猫巷女王i
猫巷女王i 2021-01-26 09:24

I\'m looking for a way to use a jpa relationship @OneToMany/@OneToOne/@ManyToOne/@ManyToMany with a ComboBox.

@Entity
public class State {

    @Id
    @Generat         


        
2条回答
  •  迷失自我
    2021-01-26 10:01

    This question is related to another question on Stackoverflow: Vaadin 7.0.1 Combobox with JPAContainer and FieldGroup.

    I wrote a blog post about this topic which explains how FieldGroups work internally and how you can make them work for this particular use case: Select Nested JavaBeans With a Vaadin FieldGroup. This post will also explain why a ConversionException is thrown in your example.

    Of course you could switch to using a BeanItemContainer, but by using a simple Converter implementation you can use any Container implementation as data source for your ComboBox. See the blog post for details.

提交回复
热议问题