-->
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.  [ 2 posts ] 
Author Message
 Post subject: parent class fields cant be null when using joined-subclass
PostPosted: Fri Jul 11, 2008 8:06 am 
Newbie

Joined: Fri Jul 11, 2008 7:48 am
Posts: 1
Hibernate version: 2.0.0.Beta1

Name and version of the database you are using: SQL Server 2005


I am using joined-subclass to define Customer inherits Person. I have written a SP GetCustomers = select * from customer.

Am executing this SP through session.GetNamedQuery to return Customer. This throws QueryException and shows up something like IndexOutofBounds for columns in Person table which is the parent class/table.

If I modify the SP and include fields from person table (parent table) then session.GetNamedQuery works fine. Is this expected behaviour ?

For querying, even with joined-subclass, I would imagine support for both scenarios viz
1. fetching just the child table data and filling the corresponding child class fields leaving the parent class fields null
2. fetching both the child and parent tables and filling the whole child entity

Any comments ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 14, 2008 3:08 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
From an object-oriented point of view that makes no sense (my opinion). You can't create a Customer without a Person. If you need to separate the data then you should consider a different model like connection a person and a customer with an association (many-to-one). Then you have the possibility to load them as you want.

_________________
--Wolfgang


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.