My head hurts now...

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 5:23 AM
> To: OJB Users List
> Subject: Re: RE-POST - INSERT and SELECT from different "tables"
>
>
> Hi Robert,
>
> for 2), you could maybe try resetting the table name in the Class
> Descriptor
> for an object type at runtime, resetting the Class Descriptor in
> the repository
> to the modified one via the PB interface, then doing your
> store(obj). Also if
> the table has different column names then you would need to
> change that info
> via the Field Descriptors (again obtained from the Class
> Descriptor). Haven't
> tried it but it's not obvious to me why that would not work (that
> does not of
> course mean that it will :-)) Worth a shot, anyway.
>
> Cheers,
>
> Chris
>
> "Robert J. Sanford, Jr." wrote:
>
> > 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]>

Reply via email to