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: Sparse population from stored procedures?
PostPosted: Tue Oct 23, 2007 1:25 pm 
Newbie

Joined: Tue Oct 23, 2007 12:04 pm
Posts: 1
Hi all,
First, let me say that I recognize that I'm skipping over most of what is asked for in the new topic template. The application that I'm working on is fairly complex, and I haven't made a smaller version to show off the problem. I can do that if necessary, but I wanted to see if I could get a pointer in the right direction first.

The basics of my issue are this: in my application, we take snapshots of data when key events happen. Depending on the event, the snapshot may be 'sparsely populated' or not. These snapshots are then saved into the database in a separate table, which has an auto-generated identity column. I have the saving and retrieving of the object from the stored table working fine, but as I go to hook in to the two stored procedures, I run into some trouble.

The first bit of trouble is that when I load it from the stored procedure, I don't have an ID. To work around this, I return a fake id from the stored procedure, and then evict it from the session afterwards. This seems a little hackish, but it works for me. If there's a good place for me to investigate about how to make NHibernate not care about the Id for reads, I'd be much obliged.

The second issue that I've run into is that the second stored procedure I use returns only a partial set of the data (with the rest being nulls in the object in question). When I try to use NHibernate to do the mapping for this finder, it generates an index out of range exception for the first of the fields that is not present in the result set. Is there a way I can configure NHibernate to leave properties which are not present in the result set as null? The difference between the two stored procedures is about 30 fields, and modifying the stored procedure to return them feels wrong.

Thanks in advance,
--Wes

Hibernate version:
1.2.0.4000

Name and version of the database you are using:
Sql Server 2000


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.