-->
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.  [ 3 posts ] 
Author Message
 Post subject: Questions on Chapter 3
PostPosted: Tue Mar 15, 2005 3:27 pm 
Newbie

Joined: Tue Feb 22, 2005 4:10 pm
Posts: 19
Hi,

I collected all my questions for Chapter 3 into one post. I hope this is not too much.

Slew of questions on Chapter 3:

1) Page 80, Controlling Insertion and updates.
“If the complete class is immutable, set mutable=”false” in the class mapping”

What is the point of doing this? Wouldn’t declaring all the member variables as final take care of this automatically just using regular Java rules? Or is this so that Hibernate won’t even try to load data twice for the same instance and cause exceptions to be thrown?


2) Page 93, Entity and value types.
”In effect, the persistence mechanism implements pass-by-value semantics for some classes.”

I am not sure I understand your term of “pass-by-value persistence.” Could you explain what you mean by that?


3) Page 97, Table per concrete class
”In figure 3.7, if the subclasses are all mapped to different tables, a polymorphic association to their superclass (abstract BillingDetails in this example) can’t be represented as a simple foreign key relationship.”

Why not? Could you explain?


4) Page 110, discussion regarding cascade=”save-update”
Page 111, bottom of the page, example showing cascade=”all-delete-orphan”.

Wouldn’t both “save-update” and “all-delete-orphan” make inverse=”true” not needed, superfluous attribute (if the other one is specified)? If no, why not?


Thanks,
NG


Top
 Profile  
 
 Post subject: Re: Questions on Chapter 3
PostPosted: Tue Mar 15, 2005 3:35 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
nistarguy wrote:
1) Page 80, Controlling Insertion and updates.
“If the complete class is immutable, set mutable=”false” in the class mapping”

What is the point of doing this? Wouldn’t declaring all the member variables as final take care of this automatically just using regular Java rules? Or is this so that Hibernate won’t even try to load data twice for the same instance and cause exceptions to be thrown?


Hibernate can make some optimizations if you set the attribute. It's not about loading things twice (this will not happen, since the Session is a cache anyway). Read chapters 4 and 5.

nistarguy wrote:
2) Page 93, Entity and value types.
”In effect, the persistence mechanism implements pass-by-value semantics for some classes.”

I am not sure I understand your term of “pass-by-value persistence.” Could you explain what you mean by that?


The topic is discussed again in chapter 6.

nistarguy wrote:
3) Page 97, Table per concrete class
”In figure 3.7, if the subclasses are all mapped to different tables, a polymorphic association to their superclass (abstract BillingDetails in this example) can’t be represented as a simple foreign key relationship.”

Why not? Could you explain?


Again, covered in more detail in chapter 6. It's quite easy to understand that it doesn't work if you look at the tables for this strategy.

nistarguy wrote:
4) Page 110, discussion regarding cascade=”save-update”
Page 111, bottom of the page, example showing cascade=”all-delete-orphan”.

Wouldn’t both “save-update” and “all-delete-orphan” make inverse=”true” not needed, superfluous attribute (if the other one is specified)? If no, why not?


inverse and cascade are not related at all. Read chapter 4 for cascade and chapters 3 and 6 for inverse.

My best advice is to read at least chapters 3, 4, 5, 6, and 7 to understand Hibernate's core concepts.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 4:07 pm 
Newbie

Joined: Tue Feb 22, 2005 4:10 pm
Posts: 19
Your best advise is to read the entire book to understand concepts explained in chapter 3 and only then ask questions?

Ok. I AM going through the entire book anyhow, but I like to understand what I am reading as I read it, especially if there is no "..We'll explain it later in chapter so and so" next to something that the book states and I don't undestand 100%.

But fine, I'll believe you that I am just lacking the material of the entire book and after I read it I'll have the answers to my questions from chapter 3. Seems odd to organize the book this way though.

No problem. I'll be back with these questions if it's not clear at the end of the read.

Thanks,
NG


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.