Thanks for the answer!
I was using 1.0.3 but now I'm upgrading to 1.0.4 to see if my luck changes


Armin Waibel wrote:
> 
> Hi,
> 
> which version of OJB do you use?
> 
> Schmidt wrote:
>> Hi,
>> 
>> I'm facing a hard time trying to fix a problem in my app. Consider the
>> floowing class hierarchy:
>> class Project {..}
>> class ChildProject extends Project {..}
>> class GrandChildProject extends ChildProject {..}
>> 
> 
> How do you set the ojbConcreteClass attribute in your java object?
> 
>> All these classes are mapped to the same table: PROJECT_TABLE
>> 
>> Here are the mappings:
>> 
>> <class-descriptor table="PROJECT_TABLE" class="br.com.xxx.model.Project">
>>     <extent-class class-ref="br.com.xxx.model.ChildProject" />
>>     ...some fields here...
>>     <field-descriptor name="ojbConcreteClass" column="CLASS_NAME"
>> jdbc-type="VARCHAR" />
>> </class-descriptor>
>> 
>> <class-descriptor table="PROJECT_TABLE"
>> class="br.com.xxx.model.ChildProject">
>>     <extent-class class-ref="br.com.xxx.model.GrandChildProject" />
>>     ...some fields here...
>>     <field-descriptor name="ojbConcreteClass" column="CLASS_NAME"
>> jdbc-type="VARCHAR" />
>> </class-descriptor>
>> 
>> <class-descriptor table="PROJECT_TABLE"
>> class="br.com.xxx.model.GrandChildProject ">
>>     ...some fields here...
>>     <field-descriptor name="ojbConcreteClass" column="CLASS_NAME"
>> jdbc-type="VARCHAR" />
>> </class-descriptor>
>> 
>> Somehow when I search for GrandChildProject objects, OJB returns a
>> ChildProject reference. This ends up in a ClassCastException. Is there
>> anything wrong in the mappings or strategy used in this example?
> 
> The mapping seems ok.
> 
> regards,
> Armin
> 
>> 
>> Thanks in advance!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Mapping-hierarchy-in-one-table-problem-tp15354434p15361600.html
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at 
Nabble.com.


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

Reply via email to