java - When can/should you go whole hog with the ORM approach? -


it seems me introducing orm tool supposed make architecture cleaner, efficiency i've found myself bypassing , iterating on jdbc result set on occasion. leads uncoordinated tangle of artifacts instead of cleaner architecture.

is because i'm applying tool in invalid context, or deeper that?

when can/should go whole hog orm approach?

any insight appreciated.


a little of background:

in environment have 50 client computers , 1 reasonably powerful sql server.

i have desktop application in 50 clients accessing data @ times.

the project's data model has gone through number of reorganizations various reasons including clarity, efficiency, etc.

my data model's history

  1. jdbc calls directly
  2. dao + pojo without relations between pojos (basically wrapping jdbc).
  3. added relations between pojos implementing lazy loading, hiding inter-dao calls
  4. jumped onto hibernate bandwagon after seeing how "simple" made data access (it made inter pojo relations trivial) , because decrease number of round trips database when working many related entities.
  5. since desktop application keeping sessions open long term nightmare ended causing whole lot of issues
  6. stepped partial dao/hibernate approach allows me make direct jdbc calls behind dao curtain while @ same time using hibernate.

hibernate makes more sense when application works on object graphs, persisted in rdbms. instead, if application logic works on 2-d matrix of data, fetching via direct jdbc works better. although hibernate written on top of jdbc, has capabilities might non-trivial implement in jdbc. eg:

  1. say, user views row in ui , changes of values , want fire update query columns did indeed change.
  2. to avoid getting deadlocks need maintain global order sqls in transaction. getting right jdbc might not easy
  3. easily setting optimistic locking. when use jdbc, need remember have in every update query.
  4. batch updates, lazy materialization of collections etc might non-trivial implement in jdbc.

(i "might non-trivial", because of course can done - , might super hacker:)

hibernate lets fire own sql queries also, in case need to.

hope helps decide.

ps: keeping session open on remote desktop client , running trouble not hibernate's problem - run same issue if keep connection db open long.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -