-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Polymorphic derived properties
PostPosted: Wed Jul 21, 2004 1:49 pm 
Newbie

Joined: Wed Feb 11, 2004 5:08 am
Posts: 14
Hi,

I have a polymorphic structure like this:
Code:
         AbstractCustomer
           /       \
PersonCustomer    CompanyCustomer
-firstname        -name
-surname


I have a getCustomerName() method in my AbstractCustomer class and it is implemented in extending classes. PersonCustomer returns a string "firstname surname" and CompanyCustomer just "name".

Now I would like to have a polymorphic reporting query against AbstractCustomer class. I would like to fetch the name and id of each customer. How should I map my classes so that this reporting query would return me the strings I want ("firstname surname" from PersonCustomer and "name" from CompanyCustomer)?

I tried to add
Code:
<property name="customerName" insert="false" update="false"/>
to the mapping of AbstractCustomer, but still I get for example "customerName" column to my DDL.

Any ideas/pointers?


Sincerely,

Jouni Hartikainen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.