What's the best way to persist data in a Java Desktop Application?

后端 未结 6 1592
再見小時候
再見小時候 2021-02-14 10:19

I have a large tree of Java Objects in my Desktop Application and am trying to decide on the best way of persisting them as a file to the file system.

Some thoughts I\'v

6条回答
  •  日久生厌
    2021-02-14 10:40

    I think it depends on what you need. Let's see the options:

    1) Descarded imediatelly! I'll not even justify. :)

    2) If you need a simple, quick, one-method persistence, stick with it. It will persist the complete data graph as it is! Beware of how long you'll be maintaning the persisted objects. As yourself pointed out, versioning can be a problem.

    3) Slower than (2), need extra code and can be edited by the user. I would only use it the data is supposed to be used by a client in another language.

    4) If you need to query your data in anyway, stick with the DB solution.

    Well, I think you had already answered your question :)

提交回复
热议问题