On Dec 10, 2003, at 4:08 AM, Mahbub ul Huq Bin Kabir wrote:


Hi,

I�m a very new comer to this technology and don�t have clear idea about persistence layer. So I decided to ask some question to this group and hopefully get a reply.

Happy to (try) to help!


Now I�m using the JDBC API for the development. I�m handling a large database with simple JDBC and have to generate reports continuously, which also contains lot of data as its contents. But I want to use the Persistence layer and I choose to use the OJB. I�m also using struts for my application development.

First of all, I have to know the basics.

� Do I have to create classes for all the Tables of my database?

No, you do not *have* to, however most O/R models at least start with a 1:1 object:table correlation.


� I have to use JOIN in my query to get the results from the database, do I have to create class for the joining in OJB?

OJB typically does joins via 1:N or M:N relationships between objects using the Collections API. If you are doing different types of filtering (say, "select e.* from employees e inner join departments d on (e.dept_id = d.id and d.name like ?)" it gets to be trickier but can still be done. Typically that type of filtering is more easily handled in the Java code when using an O/R mapping tool like OJB.


Actually, looking at the above example the better way to do it from an O/R perspective would be to retrieve the department ("select dept from " + Department.class.getName() + "where name = $1") and then map employees in that department as a collection on the Department. So while you are looking for employees, you are really looking for a department's employees.

� OJB doesn�t provide the aggregate function, how this could be solve in OJB?

I will let someone else answer this one ;-)


� What about the performance when handling large database and what about the memory requirements?

Carefully crafted SQL can almost always be faster to execute than any O/R tool as there is simply an extra execution layer between the data and the logic. OJB performs *very* well for an O/R tool and you would typically need a very well crafted set of queries, and a strong hand-crafted caching system, to get better overall performance. O/R tools, and OJB as one, typically trade a little bit of performance potential (potential being key) for a lot of productivity.


� Between the Persistence Broker, ODMG, JDO which one I should use and why?

It depends on your needs. There are situations where one is better than the other, but it very much depends on your exact needs.


-Brian


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to