Brandon
On 10/10/06, Jeff Butler <[EMAIL PROTECTED]> wrote:
Hi All,We have an issue that I believe is quite common with enterprise databases. Many (most) of the tables contain fields that are necessary for insert/update, but those fields do not really belong in our domain objects. These fields are often related to audit tracking in the tables (update timestamp, update user, update process, etc.).In my mind, these fields are DB trash that do not belong in domain objects. However, if we build our POJOs without the DB trash, inserts and updates become problematical. We've tried these approaches to the problem:1. Put every field in a Map for insert/update, pass the Map as parameter object2. Put the POJO in a Map, add the DB trash to the Map, pass the Map as a parameter object3. Create some special subclass of the POJO that adds the DB trash, then do the get/set dance to populate the subclass and pass the subclass as a parameter object4. Create pseudo POJOs that exactly match the table, do the get/set dance from our real POJOs to the table specific POJOs, and then fill in the DB trash columns as appropriate in the table specific POJOsEach of these approaches has a particular smell - sometimes forcing the use of Maps, sometimes forcing the get/set dance, sometimes both. I'm favoring #4 right now, but still - it's not optimal.My thought is that this whole issue could be elegantly solved if we allowed multiple parameter classes like this:<insert id="insertCustomer" parameterClass="Customer, DBTrash">...</insert>and then we added special processing for supporting a List of parameter objects passed in on the SqlMapClient methods.What are your thoughts? Have I missed some different and better way of dealing with this issue? Would this approach be too difficult to implement in iBATIS?Jeff Butler