Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.1.7
Hi there. When I have an pojo with a version attribute. And this pojo is used by another pojo in a many-to-one association. Do I need to load the entire object before associating it with the parent object?
For eg.
Car has an Engine
When creating a new car with the following code:
Code:
Car car = new Car();
Engine engine = new Engine();
engine.setID(new Long(1));
car.setEngine(engine);
Hibernate tries to persist the engine pojo, even this engine (ID=1) exists on the table. Now if I have:
Code:
Car car = new Car();
Engine engine = (Engine)engineDAO.findByPrimaryKey(new Long(1));
car.setEngine(engine);
Works just fine. Must hibernate fetch the entire object when using versioning? Is there a workaround?
I'm using a timeStamp as versioning
Thanks all