-->
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.  [ 6 posts ] 
Author Message
 Post subject: list-index base="1" will issue a separate update s
PostPosted: Thu Aug 25, 2005 12:36 am 
Newbie

Joined: Wed Aug 24, 2005 1:53 pm
Posts: 4
Hi all,

Hibernate version:
3.0.5

Mapping documents:
.....
<list
name="lesQuotDetails"
lazy="true"
inverse="false"
cascade="all-delete-orphan"
>
<key column="QUOT_SEQ" not-null="true"/>
<list-index column="LINE_SEQ" base="1"/>
<one-to-many
class="LesQuotDetail"
/>
</list>
.....

Name and version of the database you are using:
Oracle 9


In this case, Hibernate will issue an INSERT statement then a UPDATE statement to reorder the LINE_SEQ starting from 1.

Is there any way to avoid the additional SQL statement?

I tried with <key column="QUOT_SEQ" not-null="true" update="false"/>
Then, I will get 1 INSERT statement but the LINE_SEQ will be starting from 0.

Cheers,
Eddie


Top
 Profile  
 
 Post subject: just curious
PostPosted: Thu Aug 25, 2005 12:58 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Just curious why do you need the index to start from 1?

Probably brain dead but cannot imagine a use case for that.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Just for consistency.
PostPosted: Thu Aug 25, 2005 2:14 am 
Newbie

Joined: Wed Aug 24, 2005 1:53 pm
Posts: 4
When the detail records are listed in the screen, the line seq is start from 1.

I want the actual DB record and on-screen numbering are consistent to avoid any confusion.


Top
 Profile  
 
 Post subject: confusions
PostPosted: Thu Aug 25, 2005 10:59 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Personally, I think it is OK to have the sequence start from 0 in DB and have it displayed as S+1 because there are so many 'confusing' moments:
For example a field in a record holds a foreign key to another record, but we tend NOT to display the FK, but rather some fields from the linked record/object. Another example would be numeric codes like 0..n which correspond to some status information like 'new','in process', 'failed', etc. that gets displayed according to user language.

PS: perhaps H should not perform an extra query, but I tend to forgive H in this case.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Re: confusions
PostPosted: Fri Aug 26, 2005 2:41 am 
Newbie

Joined: Wed Aug 24, 2005 1:53 pm
Posts: 4
kgignatyev wrote:
PS: perhaps H should not perform an extra query, but I tend to forgive H in this case.


It's OK. I just wonder if there is any mis-configuration that cause the extra SQL statement.

Besides, I want to emphasis that the setting update="false". If I set it inside <key column=.. update="false"/>, base="1" will be ignored. The resultant records will be starting from 0,1,2,....

It will be nice if the doc tell us more about the list-index information.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 4:54 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
open a bug report

_________________
Emmanuel


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