I am asking everyone who aren't utilizing a library with this, but they are creating your personal objects for controlling data flowing back and forth from your database tables. Have i got a recordset object? one object per row of information? Both? Neither? Any suggestions or encounters welcome. Do not let me know to make use of an ORM or any other such toolkit. It's overkill for my project and besides, that isn't the question now, could it be?
i'd highly recommend obtaining martin fowler's patterns of enterprise application architecture, it describes numerous database designs that might be useful to understand, and provide you with a concept of the evolution of designs to complete ORM libraries.
specific designs you might be thinking about:
these fundamental designs provides you with a concept of how you can structure your objects, and also the more complex designs (like active record/data mapper) you will see how individuals connect with problem domain names beyond where your requirements are right now.
Your computer data model is centered through the domain organizations -- the actual-world things. Real life things can often be planned to single rows inside a database. One Entity is a Object is a relational row -- mostly.
Sometimes real-world organizations are actually complicated and span multiple database rows. This is actually the "Aggregate" problem. Objects could be aggregates. Relational rows can't be easily aggregates having to break all of the normal form rules.
Sometimes, due to class inheritance, you will be stumped regarding ways to get the item planned to some database row. Could it be one row per layer from the inheritance hierarchy? Or are all the layers flattened lower to posts in every subclass table?
Furthermore, you must have collections of things (a database is an accumulation of collections of things).
These "collections" or "record sets" or "managers" or "data access objects" mediate between persistence (SQL?) as well as your domain organizations. The record set develops your domain objects from whatever SQL stuff it can access. Similarly, the record set unwinds your domain objects into SQL stuff.
ORM is an excellent method additional the ORM framework provides these class definitions. If the ORM is "overkill", borrow the look designs. Browse the iBatis API. [While you are in internet marketing, you might find that there are nothing not big enough for ORM.]
In a nutshell, both: "recordset object" plus "one object per row of informationInch -- roughly.
If you think the necessity to roll your personal record set collections, you can test and employ simple serialization to persist your objects. You will have difficulties stacked on the top of difficulties attempting to serialize aggregates and subclass associations. Why? Objects have direct references to one another. SQL database needs to emulate this with primary secrets and foreign secrets.
Regardless of size any project I'd say make use of an ORM :-P
In the times when there have been no ORM libraries we accustomed to by hand pull all of the fields from a Java recordset object and plug them right into a real Java class.
The inverse requested insertions and deletion (having a flag to point that was to occur)
Multiple rows were usually stuffed into a listing.