Re: DataObject constructor from two other DataObjects

From: Cris Daniluk (cris.danilu..mail.com)
Date: Fri Dec 02 2005 - 12:54:07 EST

  • Next message: Eric Schneider: "limit of objects for in-memory filter?"

    I think he may be raising the larger point that school/people may need
    to be immutable properties for an object. It might be nice if Cayenne
    had a way to mark certain properties "read-only", and provide a
    mechanism to set them for the first time.

    On 12/2/05, Mike Kienenberger <mkienen..mail.com> wrote:
    > Student student = new Student(onepeople, oneschool);
    >
    > ....but I only know the standard DataObject constructor:
    >
    >
    > // This is psuedo-code
    > Student student =
    > (Student)dataContext.createAndRegisterNewObject(Student.class);
    > student.setSchool(oneSchool);
    > student.setPeople(onePeople);
    >
    > On 12/2/05, Andrea Borgogelli Avveduti <borgogell..otmail.com> wrote:
    > >
    > > Hi boys,
    > >
    > > in my example the ER schema has 3 tables:
    > >
    > > 1) People (PK is a code like social security number: varchar(20))
    > > 2) Schools (PK is a counter)
    > > 3) Students (PK is people's social number and school's ID)
    > >
    > > ObjectOriented options:
    > >
    > > 1) I can modelling the Student class with multiple-inheritance from People
    > > and Schools class
    > > 2) I can modelling the Student class as stand alone class with some
    > > relations with the others two.
    > >
    > > The questione is:
    > >
    > > I have choose the second OO architectural option. So, how can I create an
    > > istance of Student from an istance o People and School.
    > >
    > > I'd like to write a method like this:
    > >
    > > Student student = new Student(onepeople, oneschool);
    > >
    > > ....but I only know the standard DataObject constructor:
    > >
    > > dataContext.createAndRegisterNewObject(ObjEntity.class)
    > >
    > > Any advices ?
    > >
    > > Thank u to all of u
    > >
    > > Ciao
    > >
    > > Andrea
    >



    This archive was generated by hypermail 2.0.0 : Fri Dec 02 2005 - 12:54:09 EST