Harish Shivaraj wrote:Hi all.
Im asking things,because im not sure if this is a best practice or how would you do it?
I have a database called Vehicle and query the database using JDBC. I have wrapper around the JDBC library such that every time i do a select on the table it return me a list of object with each object corresponds to a row in the table.
I mean this
Table - Vehicle
Select method
public ArrayList<Vechile> Select(...) { .. }
Would you do it this way or would you just return the ResultsSet? I found it much neater when ? I return the Vehicle object where each row data is content within an object.
Thanks
Anton Golovin ([email protected]) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Anton Golovin wrote:[
For example, in raw SQL you will have not only direct selects, but joins and sometimes queries that should calculate data on the fly before returning it to you. I am just giving you some hints about using ORM correctly because if you use it to get array on entities mapped to single tables, and you need to do joins, you will find yourself bringing that data into the code and transforming it there - not a performant way to work with ORM.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
Harish Shivaraj wrote:Thanks very much. One things im finding it difficult is this. That every time I change the table specification I need to change a lot things in my code. And I see huge maintenance problem down the line.
Anton Golovin ([email protected]) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]