The moose likes Object Relational Mapping and the fly likes How to write custom DAO's Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "How to write custom DAO Watch "How to write custom DAO New topic
Author

How to write custom DAO's

Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
Hi,
I want to write custom DAO's instead of letting Hibernate Synchronizer to do this for me? Is there any solution? I know how to stop HIbernate Synchronizer from generating the DAO's but i want to know how to write that in a generic way so that i can generate my own DAO's...

Thanks a Lot in Advance...

Venkat Dasari


Regards,<br />Venkat Dasari<br />SCJP 1.4, SCBCD.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16356

Sorry, but why in the heck would you want to do that? If you are goig to use Hibernate, then I'd think you wanted to because it makes it easier for your code. If you want to write your own DAO's instead of using theirs, but use everything else, then you are over complicating things.

You can create your own DAO's and DTOs yourself, but then you are just recreating Hibernate from scratch. :shrug

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Luigi Smith
Ranch Hand

Joined: Nov 08, 2003
Posts: 54
Unless you like pain (or this is an academic project), you should seek not to recreate the wheel and look to some other DAO frameworks. We didn't use HibSync DAOs either, but what we did do was let it produce the original DAOs and then turn the base classes into Spring DAOs (or iBatis DAOs). Information on either are at there respective sites. We finally used the Velocity support in HSync to create our DAOs for the particular framework we were using. This was very simple to do with Spring, btw.

Another useful project that takes a real transparent approach is: http://oness.sourceforge.net/multiproject/oness-common-model/xref/index.html.

Good luck!
Lou


Luigi<br />------------<br />Sun Certified Java Programmer<br />IBM Certified Enterprise Developer WSAD 5.0
 
 
subject: How to write custom DAO's
 
jQuery in Action, 2nd edition