This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm just reading up hibernate right now, it seems to be pretty cool. I'm updating an application which interact with database. I can't chaneg the database design because other external tools use and update it as well. The databae contains over 8000 tables, each table definition is the same, with the except of data itself. Each table has about 2000 - 50000 records. Hibernate was suggested and we are doing reseach right now. I like the idea the that no more JDBC and sql, but from my research, it seems that we have to maintain the mapping files, which is abit too much considering 8000 tables. If I read the document wrong, please correct me. The last thing I want to do is to getting all the user interface and logic done, then stuck with Hibernate part and realize it's a maintenance nightmare. Any help is appreciated.
If there really are 8000 (!) tables and they're basically identical except for name and data, I would probably be looking at using a single, parameterized DAO for those tables. I.e. something like MyGenericDAO dao = new MyGenericDAO("table7999"); Record record = dao.getRecord(123);
I am also new to hibernate, I have read that if you use xdoclet (hibernatedoclet), it can generate the mapping for you, so in theory, it can save you a lot of time. http://xdoclet.sourceforge.net
Joined: Oct 02, 2000
Yes, there are 8000 tables, and I can't do anything about it because too many vendors update the tables. I really would hate to write SQL for my application, I'm looking at any other options that can help me to simply the process. I'm not sure what DAO (Data Access Object?) is.
Joined: Jan 23, 2002
Originally posted by Adrian Yan: I'm not sure what DAO (Data Access Object?) is.
Exactly. If the tables really are identical, it should be possible to write one DAO and parameterize the table name. The SQL would then be constructed dynamically for each new instance of the DAO class with "SELECT * FROM table_" + tableName + " WHERE id = ?", for example
Joined: Oct 02, 2000
Cool, I see it now. That pattern is what I had in mind without knowing it's a pattern . I guess there is no way to avoid SQL now . That's fine, it should work just fine. Thanks for the help guys.
Originally posted by Adrian Yan: Cool, I see it now. That pattern is what I had in mind without knowing it's a pattern . I guess there is no way to avoid SQL now . That's fine, it should work just fine. Thanks for the help guys.
Of course there is. However, your requirements don't call for something as sophisticated as Hibernate. When given two choices and all things being equals always choose the simplest option. In this case, the simplest thing appears to be writing a bit of JDBC code.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com