You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Brian McCallister <mc...@forthillcompany.com> on 2004/04/02 15:34:29 UTC

Re: Searching in a class hierachy (ODMG) (Nudging Armin)

Ah, thank you for posting the mappings.

Will need to nudge Armin on this, I haven't used joins to map extents 
before =(

-Brian

On Apr 2, 2004, at 5:41 AM, Keith Rogers wrote:

> Could you clarify what you mean by that?
>
> Here is the relevent part of the config file:
>
> <!-- USER -->
> <class-descriptor class="com.mp.hato.ojb.OJBUser" proxy="dynamic"
> table="users">
>     <field-descriptor name="id" column="user_id" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true"/>
>     <field-descriptor name="username" column="username"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="password" column="password"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="emailAddress" column="emailAddress"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="userLevelId" column="level"
> jdbc-type="INTEGER"/>
>     <field-descriptor name="userStatusId" column="status"
> jdbc-type="INTEGER"/>
>
>     <reference-descriptor name="userLevel"
> class-ref="com.mp.hato.ojb.OJBUserLevel" auto-retrieve="true">
>         <foreignkey field-ref="userLevelId"/>
>     </reference-descriptor>
>
>     <reference-descriptor name="userStatus"
> class-ref="com.mp.hato.ojb.OJBUserStatus" auto-retrieve="true">
>         <foreignkey field-ref="userStatusId"/>
>     </reference-descriptor>
> </class-descriptor>
>
> <!-- PERSON -->
> <class-descriptor class="com.mp.hato.ojb.OJBPerson" proxy="dynamic"
> table="people">
>     <field-descriptor name="id" column="user_id" jdbc-type="INTEGER"
> primarykey="true"/>
>     <field-descriptor name="surname" column="surname"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="forename" column="forename"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="title" column="title"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="preferredName" column="preferredName"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="nationalInsuranceNumber"
> column="nationalInsuranceNumber" jdbc-type="VARCHAR"/>
>     <field-descriptor name="sex" column="sex" jdbc-type="BIT"/>
>     <field-descriptor name="daytimeTelephoneNumber"
> column="daytimeTelephoneNumber" jdbc-type="VARCHAR"/>
>     <field-descriptor name="eveningTelephoneNumber"
> column="eveningTelephoneNumber" jdbc-type="VARCHAR"/>
>     <field-descriptor name="mobileTelephoneNumber"
> column="mobileTelephoneNumber" jdbc-type="VARCHAR"/>
>     <field-descriptor name="jobTitle" column="jobTitle"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="driverNumber" column="driverNumber"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="nextOfKinTitle" column="nextOfKinTitle"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="nextOfKinSurname" column="nextOfKinSurname"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="nextOfKinForename"
> column="nextOfKinForename" jdbc-type="VARCHAR"/>
>     <field-descriptor name="nextOfKinRelationship"
> column="nextOfKinRelationship" jdbc-type="VARCHAR"/>
>     <field-descriptor name="homeAddressId" column="homeAddress"
> jdbc-type="INTEGER"/>
>     <field-descriptor name="workAddressId" column="workAddress"
> jdbc-type="INTEGER"/>
>     <field-descriptor name="nextOfKinAddressId"
> column="nextOfKinAddress" jdbc-type="INTEGER"/>
>
>     <reference-descriptor name="homeAddress"
> class-ref="com.mp.hato.ojb.OJBAddress" auto-retrieve="true"
> auto-update="true" auto-delete="true">
>         <foreignkey field-ref="homeAddressId"/>
>     </reference-descriptor>
>
>     <reference-descriptor name="workAddress"
> class-ref="com.mp.hato.ojb.OJBAddress" auto-retrieve="true"
> auto-update="true" auto-delete="true">
>         <foreignkey field-ref="workAddressId"/>
>     </reference-descriptor>
>
>     <reference-descriptor name="nextOfKinAddress"
> class-ref="com.mp.hato.ojb.OJBAddress" auto-retrieve="true"
> auto-update="true" auto-delete="true">
>         <foreignkey field-ref="nextOfKinAddressId"/>
>     </reference-descriptor>
>
>     <reference-descriptor name="super"
> class-ref="com.mp.hato.ojb.OJBUser" auto-retrieve="true"
> auto-update="true" auto-delete="true">
>         <foreignkey field-ref="id"/>
>     </reference-descriptor>
>
>     <collection-descriptor name="qualifications"
> element-class-ref="com.mp.hato.ojb.OJBQualification" auto-insert="true"
> auto-update="true">
>         <inverse-foreignkey field-ref="userId"/>
>     </collection-descriptor>
> </class-descriptor>
>
> <!-- STUDENT -->
> <class-descriptor class="com.mp.hato.ojb.OJBStudent" table="students">
>     <field-descriptor name="id" column="user_id" jdbc-type="INTEGER"
> primarykey="true"/>
>     <field-descriptor name="notes" column="notes"
> jdbc-type="VARCHAR"/>
>
>     <reference-descriptor name="super"
> class-ref="com.mp.hato.ojb.OJBPerson" auto-retrieve="true"
> auto-update="true" auto-delete="true">
>         <foreignkey field-ref="id"/>
>     </reference-descriptor>
> </class-descriptor>
>
> <!-- ADDRESS -->
> <class-descriptor class="com.mp.hato.ojb.OJBAddress" proxy="dynamic"
> table="addresses">
>     <field-descriptor name="id" column="uid" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true"/>
>     <field-descriptor name="line1" column="LINE1"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="line2" column="LINE2"
> jdbc-type="VARCHAR"/>
>     <field-descriptor name="town" column="TOWN" jdbc-type="VARCHAR"/>
>     <field-descriptor name="postcode" column="POSTCODE"
> jdbc-type="VARCHAR"/>
> </class-descriptor>
>
>>>> mccallister@forthillcompany.com 04/01/04 06:42PM >>>
> Does the table OJBStudent is mapped to have the column? OJB is smart
> about only querying on tables that define attributes across extents.
>
> How are these classes mapped and what does the schema look like?
>
> -Brian
>
> On Apr 1, 2004, at 10:00 AM, Keith Rogers wrote:
>
>> I have a hierachy of classes that goes like this:
>>
>> user->person->student
>>
>> the user has a property called userStatus, which is a reference to
>> another table.
>> What I'm trying to do is get a list of students with a particular
>> userStatus
>>
>> When I do the query for users like this:
>>
>> select ojbs from com.mp.hato.OJBUser where userStatus=1
>>
>> It works fine. However, when I try
>>
>> select ojbs from com.mp.hato.OJBStudent where userStatus=1
>>
>> I get a message
>>
>> java.sql.SQLException: Column not found,  message from server:
> "Unknown
>> column 'userStatus' in 'where clause'"
>>
>> Why is this happening when I use the student class, but not the user
>> class? As far as I can tell, apart from this the inheritance has
> worked
>> fine - if I retreived a student object I can access all the
> inherited
>> fields, including the userStatus. So, I think its a problem with the
>> query rather than the inheritance setup.
>>
>> Does anyone have any ideas?
>>
>>
>> The information in this e-mail is confidential and intended to be
>> solely for the use of the addressee(s) and may contain copyright
>> and/or legally privileged information.  If you are not the addressee
>
>> (or responsible for delivery of the message to the addressee) please
>
>> e-mail us at Postmaster@mouchelparkman.com and delete the message
> from
>> your computer; copying, distribution, use or disclosure of its
>> contents is strictly prohibited.
>> As Internet communications are capable of data corruption no
>> responsibility is accepted for changes made to this message after it
>
>> was sent. For this reason it may be inappropriate to rely on advice
>> contained in any e-mail without obtaining written confirmation of
> it.
>> In addition, no liability or responsibility is accepted for viruses
>> and it is your responsibility to scan attachments (if any).
>> Please note that for business purposes, outgoing and incoming emails
>
>> from and to the company may be monitored and recorded.
>>
>> Mouchel Parkman UK Ltd, Registered in England at West Hall, Parvis
>> Road, West Byfleet, Surrey UK KT14 6EZ Registered No : 1686040
>>
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
> The information in this e-mail is confidential and intended to be 
> solely for the use of the addressee(s) and may contain copyright 
> and/or legally privileged information.  If you are not the addressee 
> (or responsible for delivery of the message to the addressee) please 
> e-mail us at Postmaster@mouchelparkman.com and delete the message from 
> your computer; copying, distribution, use or disclosure of its 
> contents is strictly prohibited.
> As Internet communications are capable of data corruption no 
> responsibility is accepted for changes made to this message after it 
> was sent. For this reason it may be inappropriate to rely on advice 
> contained in any e-mail without obtaining written confirmation of it.
> In addition, no liability or responsibility is accepted for viruses 
> and it is your responsibility to scan attachments (if any).
> Please note that for business purposes, outgoing and incoming emails 
> from and to the company may be monitored and recorded.
>
> Mouchel Parkman UK Ltd, Registered in England at West Hall, Parvis 
> Road, West Byfleet, Surrey UK KT14 6EZ Registered No : 1686040
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org