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.  [ 5 posts ] 
Author Message
 Post subject: how to update/load an object with only specific columns
PostPosted: Tue Jun 10, 2008 10:55 am 
Newbie

Joined: Tue Jun 10, 2008 10:32 am
Posts: 4
i have a table with large columns (Text , blob). after persisting my object, i need to be able to modify only some specific columns to avoid loading or inserting large data columns that are not used for some specific cases like updating status. what is the best way to handle these kind of issues using nhibernate session.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 10, 2008 9:36 pm 
Newbie

Joined: Wed Jul 20, 2005 12:57 am
Posts: 15
Location: Sydney, Australia
Quote:
i have a table with large columns (Text , blob). after persisting my object, i need to be able to modify only some specific columns to avoid loading or inserting large data columns that are not used for some specific cases like updating status


I'm not sure if I have the best way for this, but I got around this issue by having a table and poco dedicated to the blog/text data eg ApplicationImage. So your class that previously had the large string or byte[] property would have a reference to the entity instance.

_________________
Christian Maslen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 6:10 pm 
Newbie

Joined: Tue Jun 10, 2008 10:32 am
Posts: 4
do you mean you have created two pocos that map to the same table. one with all the columns and the other one with only some "light" columns, (+ other possibilities). this can be a nice workaround, but it would be nice addition to nhibernate if we define subsets of same poco with some kind of identifiers (named subsets) in the mapings file and specify that in the session while loading/upserting. only the concerned columns will be selected and put back to the data store.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 19, 2008 10:17 am 
Newbie

Joined: Thu Jun 19, 2008 10:08 am
Posts: 1
when we could see this problem be resolved ?

i've ever used serval ORM tools, at this point, support better then NHibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 22, 2008 1:21 am 
Newbie

Joined: Wed Jul 20, 2005 12:57 am
Posts: 15
Location: Sydney, Australia
Quote:
do you mean you have created two pocos that map to the same table. one with all the columns and the other one with only some "light" columns, (+ other possibilities). this can be a nice workaround, but it would be nice addition to nhibernate if we define subsets of same poco with some kind of identifiers (named subsets) in the mapings file and specify that in the session while loading/upserting. only the concerned columns will be selected and put back to the data store.


Sorry for the late reply... No, I mean two pocos and two tables. I'm not sure the above solution would work. In my particular case I had a need to store uploaded images from a web site. My first attempt was to put the image with the related poco data, but I found myself not always needing to select the image data and conversely selecting the image when not selecting the rest of the data. So in my case 2 pocos was the best approach anyway.

In another app we stored PDF documents. We found issues listing the document info in say a grid so the user could click to the actual content in another page. We got around this by using a projection query to not select the PDF content when populating the grid, but looking back I felt a separate table and associated object would have worked better.

_________________
Christian Maslen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.