Red Hat Associate |
|
Joined: Mon Aug 16, 2004 11:14 am Posts: 253 Location: Raleigh, NC
|
By default this will not go to the database:
Other other = (Other) session.load(Other.class, otherId);
Then you can set your association:
this.setOther(other);
session.save(this);
Pseudo-code, obviously ;)
The reason is that by default, load() will give you an uninitialized proxy containing exactly one field - the ID. Note that get() will always hit the database so it won't work for this situation. For JPA, use getReference().
-Chris
_________________ Chris Bredesen Senior Software Maintenance Engineer, JBoss
|
|