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?
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...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus