I agree with @Timo. The only other understanding I would like to add / expand is that ORM has different semantics from pure access to your sql based data.
The ORM point should ignore the fact that your data is in the database as much as possible. When you use ORM correctly, all save operations are performed in a single (hopefully) thin layer. Your model objects will have almost no save code; the fact that you are using ORM should be invisible to your model.
Because of this, ORM is very good at making your life easy for certain types of operations, namely simple CRUD operations. You can load model objects, represent them, update them, and delete them easily. This makes your life easier, because when you access your data, you return model objects on which you can write business logic. If you use JDBC, you will have to “remove” your object instances from the data, which can be complex and error prone.
ORM is not always the best choice. JPA is a tool for work, if the tool is not enough for the job, you need to find the best tool. For example, I had a scenario when I had to copy the entire graph of objects and save a new copy of these objects. If I used ORM (as I tried to do this), I had to download all the objects from the database, then copy them, and then save the new objects. I have been studying for too long.
The best solution was to simply use jdbc-based operations and "paste through select" sql calls to create new rows. It was fast, the code was simpler.
Another thing to keep in mind is that you are comfortable with JDBC, and you have deadlines, you don’t have to jump on the ORM winner. The Spring JdbcTemplate classes are extremely efficient and useful. Sometimes the best tool for the job is the one you know. You should familiarize yourself with ORM, but not necessarily for a project with high expectations. There are many opportunities for learning, and its not trivial - indeed, you are trading one set of difficulties with another in choosing to use jdbc vs orm.
hvgotcodes Jan 01 '10 at 2:31
source share