Assume I have a dead simple hibernate object with two fields, ID and Name, ID being an int primary key, Name a string.
I run a query to get all the rows in the table, and use toArray() function of list to return all the objects, modify one of them and flush the session. Presumably hibernate has no way of knowing I have made a change because the objects I'm working on are copies made by the call to toArray(). Is this right and is there a way of getting ALL the hibernate objects from a list so that implicit updates work?
The code.
Code:
List list = session.find( "from MyObjects" );
MyObject[] objects = (MyObject[])list.toArray();
objects[ 0 ].setName();
session.flush();
Is the alternative to iterate and use get( i )?
Cheers.
Myk.