2009/10/2 Krzysztof Białek <[email protected]>: > I'm considering if it is possible to use Qi4j for modelling business logic > when the persistence is done by relational database which exposes only > stored procedures. > The conditions are as follows: > 1. I don't know the schema and have no access to the tables. > 2. I can only call the stored procedures. > 3. Typically there are CRUD SPs available plus some specialized SPs for > fetching filtered data. > 4. Business logic is located only in Java application. > > I'm not going to implement such application at the moment but I think that > this impedance mismatch might become an obstacle for Qi4j adoption in many > (huge) companies.
If you on top of that add the SPs that does the updates, and you have the complete picture. Ok? > 1. Reuse existing EntityStore implementation - I don't know which one should > I pick. Maybe QRM? > 2. Write dedicated EntityStore implementation. > 3. Use database as a regular service. From my own experience, when SPs enter the picture the uniformity tends to disappear, and generic interfacing solutions become near impossible, so I think the EntityStore route will in most cases be hopeless. I think 3. is the your preferred choice. Your domain model creates an anticorruption layer around the SP, which is available to the domain model. Some of that AC could potentially be generic, so that heaps of boiler-plate code won't be needed to write. Now, compare that with the "competition", like Hibernate... I am no Hibernate expert, but I have a hard time imagining the possibility of attempting to map Hibernate against randomly organized SPs. Especially, since Hibernate caching will probably be totally buggered, since the update in the SP can reach "any data", making it impossible for Hibernate (or any similar technology) to invalidate the caches. Caching might be a important aspect in a Service oriented approach as well, but since you will be in charge of the cache implementation, you know how to tailor it to do proper cache invalidations, whereas in Hibernate, such attempt is probably foolish. Does this answer your questions? Cheers -- Niclas Hedhman, Software Developer http://www.qi4j.org - New Energy for Java I live here; http://tinyurl.com/2qq9er I work here; http://tinyurl.com/2ymelc I relax here; http://tinyurl.com/2cgsug _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

