-->
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.  [ 4 posts ] 
Author Message
 Post subject: Subclass mapping with different properties on SAME ROW
PostPosted: Tue Feb 03, 2004 2:40 pm 
Newbie

Joined: Tue Feb 03, 2004 2:30 pm
Posts: 3
Location: London, UK
Hi All,

I am, very, new to this, but I'll give it a go. I've been trying to setup a mapping for an existing table. The table has a bunch of properties of which I only want to retreieve a certain subset of them. I have this working fine, I have a mapped class, a config file and a test rig. This all works just as one might would expect.

However, I want to have another class, logically a subclass in my object model which contains everything the inital object has and more. In reality I just want to include all the columns that appear as properties in the first object and some more. I've tried to create a subclass but it complains about a discriminator. Although marked as optional I'm assuming it's needed as I have a one-table-per-hierachy here. The only thing is that I don't have two rows, same id and a discriminator. I just have one row, where I want a little bit of the data and then some more of the data from a sensible object model.

Is this possible?

Any help, much appreciated,
Regards,
Max


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2004 2:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Probably polymorphism=explicit could remove the need for a discriminator. Otherwise try mapping both classes as seperate instances. Also take a look at http://www.hibernate.org/41.html


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 7:01 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check that http://www.hibernate.org/Documentation/LightweightClass

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Wed Feb 04, 2004 7:24 am 
Newbie

Joined: Tue Feb 03, 2004 2:30 pm
Posts: 3
Location: London, UK
Hi Guys,

Thanks for that, I was wondering, from that two more things

1) Does anyone know if an Oracle Blob is lazily loaded? It appears
not, because after I have closed a hibernate session, I can still
call getbytes(1,MAX_INT) and have it return the correct data. If
it were lazyily loaded I would expect that to fail, or does it somehow
have some sort of reference back to the database which it can use?


2) Where can I find out more on Projection?

Kind Regards,
Max


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.