What collections does jpa return?

后端 未结 2 1624
清酒与你
清酒与你 2021-01-25 19:02

Does JPA ( Eclipselink in this case) always return IndirectList where Entity have a List? Is ok that list or It should be converted to another list( maybe linkedlist)?

2条回答
  •  遥遥无期
    2021-01-25 19:29

    Since List is an interface the JPA provider is free to return any implementation. EclipseLink rerurns an IndirectList where a List is used. This is perfectly fine since the IndirectList is a List.

    For the record or for future reference, it is generally best practice to use interfaces with JPA.

提交回复
热议问题