-->
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: Working with partil fetch and updates
PostPosted: Mon Mar 26, 2007 4:43 pm 
Beginner
Beginner

Joined: Sun Feb 19, 2006 5:13 am
Posts: 22
Hi

I have a system where I like to fetch and update only parts of an objects properties. I know that fetching parts can be done with select new Object(prop1,prop2,..) but that requires me to have an constructor with the properties. I have an external property model that tells me what properties to fetch and I use a dynamic-component to fetch them into an object called "Record". I dont want to create a select clause "on the fly" where I choose the required fields and execute the query to get a array of Object[], which I put into the map of the dynamic component. Instead I would love to tell the session that it should only fetch these field into the dynamic-component using some sort of live filtering and also have the same functionality for updating so that only certain fields are updated. I know that dynamic-update exists but it only says that all non-null properties should be updated, but I want to be able to choose exactly which properties to update, even null values if necessary.

So I guess what I want to do is select new(...) from EntityName where ... without having the consructor available...hmhmhm I wonder if I can do
select new EntityName(new Map(a.value1,a.value2,a.value3)) from ...
and just have private constructor with a Map.

We'll anyway want I want to do is to have a dynamic object that I can fetch/update with partial data only...make any sense ?


Cheeers

Magnus


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 4:25 am 
Beginner
Beginner

Joined: Thu Feb 01, 2007 3:08 am
Posts: 20
Use Projections and ResultTransformer to fetch the columns on the fly.ResultTransformer uses the setter methods instead of constructor

I don't think hibernate supports dynamic updates(using objects).



PS : please don't forget to give credits below if you found this answer useful :)


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.