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
|