Hi,
i have some basic questions which are not covered by the tutorial, i hope someone could help me.
1. i have a datatype Contact with a property Address (another java bean). i defined an one-to-one relation at the hibernate files and save both classes to my db. the mapping works fine but i have to save the address by my own.
for example:
session.save(address);
session.save(contact);
is it possible with hibernate (and it should be possilbe theoreticly) only to save the contact class and the address property is saved automaticly? hibernate should check the fields and safe address for its own?
2. how to handle the session thing. i have a manager for my Contact datatype. Should i create a session in the constructor and leave it open till end of programm or should i create and close the session within a method of the manager? i think this is a design question.
thx in advance
dominik
|