Matthew Baird wrote: >1. no >2. no > >#2 custom rowreader might be able to do this. Sounds like a lot of trouble though. I >doubt many people (if anyone) is trying to do #2 right now, so I wouldn't expect a >flurry of help on this. I can see how it would be helpful, although difficult, to >accomplish. > > In my last application, which was not with OJB, I would have a similar need to #2. Every table had a "Deleted Flag" (don't blame me, I inherited the data schema). I started off just loading objects with a suitable where clause. The problem was, when you have A contains B contains C, and you want to load all the C, you have to look at 3 DeletedFlags to be sure you've got it right (or change the way Delete works, which might have made more sense, but that meant deleting an A would be hitting 15 tables - still would have paid for itself I suspect), so I created views to match all the tables that only showed non-Deleted entries.
>m > >-----Original Message----- >From: Robert J. Sanford, Jr. [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, September 11, 2002 3:37 PM >To: [EMAIL PROTECTED] >Subject: RE-POST - INSERT and SELECT from different "tables" > > >I am using a home-grown persistence layer in my current project. It gets the >job done but has gotten to the stage where taking it forward will be much >more expensive than grabbing something like OJB for future projects. But >there is one thing (isn't there always?) about it that I really like. > >Let's say that I have an Employee table with a need to link to a department. >Following some semblance of 3NF I have a distinct department table that has >an OID and a Name column. The Employee table simply uses the OID. I then >create a nice little VIEW that has all of the employee data joined with the >department data in a human readable form. I use this VIEW as the source when >loading up my employee objects from the database and there is a read-only >attribute for the department name. Very nice. That means that I only have >one database hit and no extra coding to get all of that information out of >the database and into the object for display in a JSP. > >Obviously that is a very simplistic example but it leads me to expanding to >say that there are some VIEWs that you cannot insert into because of >relational integrity issues. I am going to waffle here and say that I don't >completely understand what is going on here because my SQL skills are far >from spectacular but my DBA wagged his finger at me when I told him what I >was trying to do. I had to set up my objects so that instead of attempting >to insert into the VIEW they were inserting into the Employee table. > >Based on that example I have to ask: >1) Does OJB have the concept of read-only attributes? I think so but I >haven't gone digging far enough. >2) Can I specify that an object be persisted to a different table than it >was read from which would allow me to select from a view and insert into a >table? > >If I can't do #2 above then how would you suggest solving the problem of >getting all the joined data into the object so I only have to make one >database hit? > >rjsjr > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
