• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Sebastian Himberger
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,

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

Sebastian
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Holding all your data in memory might not as insane an idea as it might sound: http://www.prevayler.org/

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...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!