0

I have a program that creates objects that should store their data (recipes) on my computer in a way that should allow me to store a couple thousand (and I would like to save storage space). But when looking at serialization I don't know what approach to take. I don't want the risk of losing data in the future which I heard is a problem and I would also like to be able to store thousands without loading up disk space. Any suggestions help. Thanks

  • Your Question is too broad for Stack Overflow. This site is for questions narrowly-focused on a specific technical issue. For general discussion, use a forums site such as http://www.JavaRanch.com – Basil Bourque Nov 15 '20 at 23:21
  • Similar: [*Do you need a database to store data in a java Desktop Application?*](https://stackoverflow.com/q/64846384/642706) – Basil Bourque Nov 15 '20 at 23:29

2 Answers2

1

Serialization protocols tend to either be error prone, or quite complicated, with you re-inventing either a database engine or journalled systems - at least, if you want them to not cause permanent corruption if your app crashes or you trip over a power cable at the wrong time.

So why not just.. bite the bullet, and use something like H2 (a database engine) together with something like JDBI (a library to talk to that database engine easily)?

rzwitserloot
  • 85,357
  • 5
  • 51
  • 72
-1

Any options for writing to disk do not carry any storage risks. Once a write has occurred, the file system (or database) is responsible for storing the file. For greater data security, you can duplicate them.

And from the point of view of system security, you can organize raid-1 (or another raid). But most likely you don't need for this task

Danis
  • 344
  • 2
  • 13
WBLord
  • 874
  • 6
  • 29
  • 2
    If you know this Question is inappropriate to Stack Overflow, why would you choose to post an Answer? – Basil Bourque Nov 15 '20 at 23:22
  • 1
    @BasilBourque It seems to me that beginners need to get a quick answer, even if the question is very stupid. Ban questions forces newcomers to leave the topic. I myself have experienced it for yourself Now I have a deeper understanding of many topics and try to share them. – WBLord Nov 15 '20 at 23:23
  • 2
    The question is not stupid, nor unworthy, but merely off-topic for this site. The question is on-topic at other sites such as http://www.JavaRanch.com/. Rather than encourage the misuse of this site, I suggest you point such people to a more appropriate resource. – Basil Bourque Nov 15 '20 at 23:26
  • 1
    As it turned out, the topic was closed. It's a pity that he didn't get a decent response, and I got a negative reputation – WBLord Nov 15 '20 at 23:28
  • @BasilBourque I think you're right – WBLord Nov 15 '20 at 23:28
  • 2
    I applaud your good intentions. And, sharing your enthusiasm, I did the same thing myself earlier today, [writing an Answer](https://stackoverflow.com/a/64847669/642706) to an off-topic and duplicate Question that should have been closed. Now I have regrets. Doing that feels good in the moment but is ultimately a disservice to the community, detracting from the aim of Stack Overflow. – Basil Bourque Nov 15 '20 at 23:32
  • 1
    Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/224605/discussion-between-wblord-and-basil-bourque). – WBLord Nov 15 '20 at 23:45