-->
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: Search with inheritance objects problem
PostPosted: Tue Mar 06, 2007 2:04 pm 
Newbie

Joined: Tue Mar 06, 2007 1:35 pm
Posts: 10
Hi guys.

I'm using Hibernate 3.2.2 with annotations. My app required object inheritance for some of our objects, and we opted on joined inheritance type. The problem is that the root object of the inheritance tree is the most importante object of the system, having 6 subclasses, and the subs with lots of attributes.

I'm building a search method for this top-element object, but as hibernate is including all 6 subclasses tables on the query, it's getting oversized, resulting on the sql error "Maximum output rowsize (32767) exceeded.". Oh, I'm using Informix database with the latest JDBC drivers.

The search method only has to deal with the superclass's atributes, so I'm searching for a way to tell hibernate to fetch only the superclass's ones. Is there a way to do that using annotations? Maybe using xml overriding?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 07, 2007 9:21 am 
Newbie

Joined: Tue Mar 06, 2007 1:35 pm
Posts: 10
I have found a way to deal with this problem. It has resulted in a few more questions, but here it goes.

For Hibernate not to load all attributes of my subclasses, I'm using hql to select only the ones I want and passing them to an apropriate superclass constructor, like that (from Hibernate's manual):
Code:
select new Family(mother, mate, offspr)
from DomesticCat as mother
join mother.mate as mate
left join mother.kittens as offspr


It's working, but the problem is the returned instance seems to be transient... Is that a way to make it persistent?

Thanks again!


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.