I have not done this to entities that did not come from the database to begin with, but maybe the following may work.
First, you have to set <class ... dynamic-update="true"> for your Car class.
Then try the following:
Code:
Car c = new Car();
car.setId(1);
session.lock(car, LockMode.NONE);
car.setName("test");
session.getTransaction().commit();
The call to Session.lock() should set the "zero"-point for your Car object. Everything you do to it after that is detected and the dynamic-update="true" setting should make sure that only changed values are sent to the database.
You might also simply consider doing a HQL UPDATE query:
Code:
update Car set name='test' where id=1