Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How to realize a POJO model with large result sets from the backend

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

this is my first posting in this saloon and i don't know if this is the best location for my question so please give me an advise if i made a mistake. I'm currently planning to develop a small application for personal training (I'm no java guru) and just stumbled over the following problem:

I would like to build my application model with POJO's because it like it having objects that are not tied to specific frameworks or tools. In my application i would have multiple POJOs wich would hold lists. E.g.

These Lists would be filled with data from the backend (e.g. DB). But at the point the Backend contains many entries (maybe 1.000.000 or more) i think it would be inefficient to store them all in memory and perform e.g. sorting operations on them (just for the case the application will have a web frontend, there could be many concurrent requests).

Another problem is that the user mostly needs only a small subset of the complete list (e.g. the 10 newest, 20 per page, only entries starting with A, etc..) but if i rely on the POJO approach i have to store the complete List in memory because the Collections Framework only works with the complete dataset. I thought about using some sort of Controller wich fills the POJOs only with the data they need to display the requested information but would this lead to good design? I want to have the POJOs as loosly coupled to the backend as possible.

How would you encouter this sort of problem? Are there any Java classes/techniques that i'm not aware of or are my requirements just not possible to solve?

Thanks in advance for your ideas!

best Regards

Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Holding all your data in memory might not as insane an idea as it might sound:

Most people, though, put their data into relational databases, often using a persistence layer. There are quite a few of them working with POJOs, Hibernate probably being one of the most popular from the open source sector.

Moving to Object Relational Mapping...
    Bookmark Topic Watch Topic
  • New Topic