Link Details

Link 138193 thumbnail
User 168002 avatar

By ilevent
via fromapitosolution.blogspot.com
Published: Dec 02 2008 / 21:45

It is a fact that we need a persistence solution. Most of applications are database-driven and need to access tables, modify data. Although there are many questions about persistence frameworks, we need them a lot when developing applications. Otherwise SQL codes scatters across applications causing an ugly and unmanageable application. Persistence frameworks build a database layer and separates concerns. Java Persistence solutions are divided into two branches. One is Java standard solutions; JDBC, EJB, JDO. The other is ORM (Object-relational Mapping) frameworks; Hibernate, Toplink, Enterprise Object Framework, iBatis etc. Let me ask the basic question that everybody somehow asks himself “Isn’t there any other solution to persistence problem simpler and more powerful?” I have been reading many problems about this issue. Last one was Sun’s attempt to simplify EJB. In fact, this is why new frameworks will never end.
  • 29
  • 3
  • 2541
  • 997

Comments

Add your comment
User 350084 avatar

Joshua.Suereth replied ago:

0 votes Vote down Vote up Reply

Although I don't agree with everything stated, this blog makes some very interesting points. Definitely worth a read for anyone using ORMs

User 186344 avatar

kunnar replied ago:

0 votes Vote down Vote up Reply

Same thoughts.

ORMs have some problems, but i still like using ORMs for database access. Why write SQL manually if it can be automatically generated? Btw., worst thing i know for accessing database is using stored procedures. Because then somebody thinks that he can tune those queries and add business logic there. There are lot of people who know SQL but no real programming languages. Then you have finally some business logic in application and some in database and you have to switch context all the time. If you set breakpoint in your Java IDE and reach to db procedure call then you never know what crap it is going to do, cant step in with debugger. One thing i really like in using hibernate is that it kills such opportunities for non real developers because SQL is generated dynamically and it cant be changed easily anymore.

User 338269 avatar

OtengiM replied ago:

0 votes Vote down Vote up Reply

I dont agree entirely all the points but it is a great article and some points are true, SQL is a DSL, why we need to reinvent the wheel with another similar DSL's.

User 265553 avatar

jonnes replied ago:

0 votes Vote down Vote up Reply

jPersist is my answer

User 190346 avatar

ilazarte replied ago:

1 votes Vote down Vote up Reply

Shout it from the top of a mountain. We need a better answer to ORM. For my latest pet project I've stripped out the usual ORM layer and have built my persistence on .sql files organized in a file hierarchy. It's amazing how much cleaner and easier everything got instantly. (yes even select * from users got its own file)

- my IDE switched to sql-dev mode when i opened the file which allows me to execute the query to test it.
- my IDE was now able to syntax check the query whereas it couldn't before in xml or java.
- it was easy to suddenly find queries in file/selections thanks to IDE file finding mechanisms
- every query had a unique name and i didn't need to come up with artificial "named queries"
- my query abstraction is the file itself- i can change from straight query on a table to a view without changing any java code...

and a host of other similar benefits.. it was like my programming environment slapped me on the head and said "duh, what were you thinking anyway!"

User 190346 avatar

ilazarte replied ago:

1 votes Vote down Vote up Reply

Another point I liked was the metadata point. How much easier would everything be if current JDBC drivers actually implemented ParameterMetaData?

User 306525 avatar

newton_dave replied ago:

0 votes Vote down Vote up Reply

Another answer is object databases, which didn't really seem addressed.

User 57355 avatar

mknutty replied ago:

0 votes Vote down Vote up Reply

He needs to get out more and see what it really available and why. He has worked too long at one place.

User 57355 avatar

mknutty replied ago:

0 votes Vote down Vote up Reply

Meant to say he is pretty much confused.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.