How to persist a List of Strings in Hibernate?

后端 未结 2 1715
半阙折子戏
半阙折子戏 2020-12-08 06:11

I seem to have problems with mapping a List in Hibernate. In our project there a class Card with contains a class Answer with Answer c

2条回答
  •  清歌不尽
    2020-12-08 06:44

    try

      @org.hibernate.annotations.CollectionOfElements(
            targetElement = java.lang.String.class
        )
        @JoinTable(
            name = "foo",
            joinColumns = @JoinColumn(name = "foo_id")
        )
        @org.hibernate.annotations.IndexColumn(
            name = "POSITION", base = 1
        )
        @Column(name = "baz", nullable = false)
        private List arguments = new ArrayList();
    

    or see this detail example

提交回复
热议问题