Persisting a Collection class with ORMLite in android

前端 未结 2 379
傲寒
傲寒 2021-02-04 16:29

I have two classes setup like the following. I am confused as to when I need to annotate something as an foreign collection and when I do not. This may also sound silly, but n

2条回答
  •  醉梦人生
    2021-02-04 17:03

    @Robert is correct. When hibernate persists a collection (or even an array), it does so with hidden extra tables with foreign ids -- in other words hidden foreign collections. ORMLite tries to adhere to the KISS principle and so has you define the foreign collections "by hand" instead.

    I've added more details about storing collections.

    http://ormlite.com/docs/foreign-collection


    This means that you cannot persist an Integer type because there is no foreign-id. Also, your code can define a foreign collection Collection or ForeignCollection. Either one will be set with a ForeignCollection. ORMLite does not support lists or other collection types.

提交回复
热议问题