Hi again,

> You are using the term runtime. To me that means that I have 
> to go in and
> physically change my class-descriptor in the repository.xml. 
> before my app
> starts up. Then when the one query has been used I go change the
> repository.xml back for all the others and start the app 
> again. I am NOW
> assuming that you mean that you can change the class-descriptor
> programatically from within the app for a particular query 
> and then restore
> it back to it's normal state. Is this accurate? 

exactly !

> Where is this 
> in the docs
> and how do you do it?

http://jakarta.apache.org/ojb/apidocs/org/apache/ojb/broker/PersistenceBroke
r.html#getDescriptorRepository()

http://jakarta.apache.org/ojb/apidocs/org/apache/ojb/broker/PersistenceBroke
r.html#getClassDescriptor(java.lang.Class)

http://jakarta.apache.org/ojb/apidocs/org/apache/ojb/broker/PersistenceBroke
r.html#setClassDescriptor(org.apache.ojb.broker.metadata.ClassDescriptor)

http://jakarta.apache.org/ojb/apidocs/org/apache/ojb/broker/metadata/ClassDe
scriptor.html

I also posted a code sample that shows how to do this some time ago to the
list. please search the mail archive.

> 
> I read an email that followed yours and it seemed to be 
> thinking your were
> suggesting the same thing :-)
> 
> Terminology is a bizarre creature.

Communication is a matter of luck :-)

cheers,
Thomas

> Cheers,
> Brandon Goodin
> Phase Web and Multimedia
> P (406) 862-2245
> F (406) 862-0354
> [EMAIL PROTECTED]
> http://www.phase.ws
> 
> > -----Original Message-----
> > From: Mahler Thomas [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 02, 2002 9:20 AM
> > To: 'OJB Users List'
> > Subject: AW: SELECT statements and OJB
> >
> >
> > Hi
> >
> > >
> > > I am thick headed... please forgive me. But one last
> > > question. (see question
> > > below).
> > >
> > > > -----Original Message-----
> > > > From: Mahler Thomas [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, September 02, 2002 8:24 AM
> > > > To: 'OJB Users List'
> > > > Subject: AW: SELECT statements and OJB
> > > >
> > > >
> > > > Hi again,
> > > >
> > > > > > 1. OJB does *not* perform "select * from", for queries!
> > > > > > If you look up objects of class x OJB will read the
> > > > > class-descriptor for
> > > > > > class x and determine all necessary columns to materialize
> > > > > an x instance.
> > > > > > The performed select contains all those columns.
> > > > > >
> > > > > > If you want to limit the number of columns you can 
> modify the
> > > > > > class-descriptor for class X do get a reduced 
> number of columns.
> > > > > >
> > > > >
> > > > > So, if i needed a full person to be materialized in one place
> > > > > and only the
> > > > > id, firstname and lastname elsewhere then I would have to
> > > > > write a couple of
> > > > > classes and their associated class-descriptor. For example my
> > > > > PersonName and
> > > > > Person would be two different object classes that are
> > > > > populated from the
> > > > > same table (PEOPLE).
> > > >
> > > > NO! You only need one persistent class Person.
> > > > You can modify the existing class-descriptor for class
> > > Person at runtime.
> > > > that is for one query you remove all columns you don not
> > > want to see from
> > > > the classdescriptor.
> > > > After finishing the query you restore the class-descriptor
> > > to its original
> > > > Form so that all other things work normally.
> > >
> > > I guess what i am saying here is i need both representations
> > > in the same
> > > web-app. For example, within the same web application, i have
> > > a place where
> > > you can 1) select a person to edit and 2) a place to edit 
> a person's
> > > information.
> > >
> > > 1) This requires that i retrieve only the ID, FIRSTNAME AND
> > > LASTNAME of all
> > > the records in the PEOPLE database. I then display the names
> > > on an html
> > > page. The user then selects which person they want to edit
> > > and we are off to
> > > edit that person's info. In this case i only want to 
> populate the id,
> > > firstName and lastName variables in the Person object/class
> > > and store it
> > > into a collection to be traversed on the html page and
> > > displayed. My problem
> > > arises in reusing my Person class because i already have it
> > > in use with step
> > > 2's class descriptor. If i undestand you correctly i will
> > > have to create a
> > > BasicPerson class that only contains the id, firstName 
> and lastName
> > > variables and a class descriptor that maps to the BasicPerson
> > > class.
> >
> > As stated in my original mail:
> > NO! You only need one persistent class Person!!!
> > You can modify the existing class-descriptor for class 
> Person at runtime.
> > that is for one query you remove all columns you don not 
> want to see from
> > the classdescriptor.
> > After finishing the query you restore the class-descriptor 
> to its original
> > Form so that all other things work normally.
> >
> > > Please
> > > read on to step 2)
> > >
> > > 2) This requires that i retrieve all of the fields for a
> > > particular person
> > > from the database table PEOPLE and populate a Person object
> > > to pass to the
> > > form that will be populated by that information for editing.
> > > Therefore, i
> > > would set up my class descriptor to get all the column 
> values from the
> > > database and poulate the Person class which has the 
> accordingly mapped
> > > setters and getters. At the same time in the same app i have
> > > need for just
> > > the retrieval of the PEOPLE table's ID,FIRSTNAME and
> > > LASTNAME. In this case
> > > i am listing all of the names of the people so that a name
> > > can be selected
> > > to edit a person's info. I don't want to get all the other
> > > fields in the
> > > records because it would be pointless to populate it with all
> > > the colums
> > > from the PEOPLE table cuz i don't need them.
> > >
> > > Conclusion:
> > >
> > > Now, does this mean that i would have to have two different
> > > classes mapped
> > > with two different class-descriptors to handle each of these
> > > situations.
> >
> > NO !!!
> > (Could somebody else please tro to explain this? I have no 
> idea why you
> > still believe that you will need two classes?)
> >
> > >
> > > If yes, then are there any planned enhancements to allow for
> > > more efficient
> > > reuse of classes?
> >
> > >
> > > I am afraid that you might take my questioning as an insult.
> >
> > Not as an insult. I simply do not get what you do not 
> understand in my
> > reply?
> >
> > cheers,
> > Thomas
> >
> > > I don't mean it
> > > that way. I just want a clear and accurate picture of what i
> > > am able to and
> > > not able to do. Also, you documentation and work on this is
> > > execellent. I
> > > know that projects grow faster than their docs and that's
> > > just reality.
> > > Great Work! I never meant to say otherwise.
> > >
> > >
> > >
> > >
> > > --
> > > 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]>
> 

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

Reply via email to