POJOs
John Abraham <[email protected]>
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <[email protected]> |
Hello there. I used SimpleORM for some projects a few years ago, but I really wanted to use POJOs, primarily because of the sheer volume of objects (and resulting memory constraints) but also because I was retrofitting an old project that had used plain JDBC calls and custom object-creation-from-query routines. So I tried Hibernate for a while. Turns out, much to my surprise, that Hibernate uses "pseudo-POJO's" with a byte-code enhancer. Sucky. :( Now that I've given up on Hibernate, for that reason and the other obvious reasons, and since SimpleORM has had some further development, I think I'll go back to SimpleORM. I'll probably use a combination of direct JDBC and SimpleORM in the next development cycle, just to make sure I'm building on the code that actually works already. So now I'm left with wondering how to best create POJOs from Hibernate objects. For instance, I have a ParcelInterface, representing the behaviour of a legal parcel of land in my simulation. I have two classes that implement ParcelInterface: SimpleORMParcel, which uses SimpleORM, and Parcel, which uses shorts, floats and chars as much as possible (instead of ints, doubles and strings) so that I can fit as many Parcels into memory as possible. What I'm wondering about is the best way of creating Parcels using SimpleORM. Presumably I'd create SimpleORMParcels simply using SimpleORM, and then create Parcels from the SimpleORMParcels. Perhaps I would have a query that makes 10,000 SimpleORMParcels at a time, and then have a method SimpleORMParcel.createPlainOldParcel: public Parcel createPlainOldParcel() which I would call 10,000 times to create a POJO memory-lean Parcel from the SimpleORMParcel. Or perhaps I would have a static method static public Parcel createPlainOldParcel(SimpleORMParcel theSimpleORMParcel) Or perhaps I'd do something completely different? I realize I should probably read about the Data Access Objects pattern (DAO), but I suspect there is "best way" to do it using SimpleORM that someone else has already figured out, that they could share with me. Again, I think I need to use POJOs for three reasons: 1) to keep memory use down, 2) to keep speed up (it is a scientific numerical simulation, I sometimes use direct field access instead of get() and set() just to make things a tiny bit faster) 3) I have legacy code that uses these POJOs Perhaps I'm wrong about needing to use POJOs, so advice to the contrary is welcome. Thanks, -- John Abraham [email protected] ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/SimpleORM/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/SimpleORM/join (Yahoo! ID required) <*> To change settings via email: mailto:[email protected] mailto:[email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/