-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: some basic questions
PostPosted: Sun Nov 06, 2005 12:54 pm 
Newbie

Joined: Sat Nov 05, 2005 5:55 am
Posts: 9
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 06, 2005 2:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
1. Read about cascade in reference docs or Hibernate In Action

2. Read Hibernate In Action

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.