Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How eclipselink handles Sequences?

The purpose of sequence preallocation is to improve performance.  If you want
your increment to be 1, then set your preallocation size to 1, and there
will be no issues.  If you want to improve performance, then you need to set
your increment to the preallocation size, if this is say 50, this will not
cause any issues with the other application if it assumes it is 1, ids will
not collide, you will have some unused ids, but that should not be an issue.

Changing DDL objects on the fly, is not a very good idea.



saasira wrote:
> 
> This following is quoted from the eclipselink User Guide :
> 
> "The key difference between Oracle Type Sequencing process and the process
> involved in table sequencing is that EclipseLink is unaware of the
> INCREMENTconstruct on the
> SEQUENCE object. EclipseLink sequencing and the Oracle SEQUENCE object
> operate in isolation. To avoid sequencing errors in the application, set
> the
> EclipseLink preallocation size and the Oracle SEQUENCE object INCREMENT to
> the same value. Note that the Oracle sequence object must have a starting
> value equal to the preallocation size because when EclipseLink gets the
> next
> sequence value, it assume it has the previous preallocation size of
> values."
> 
> We have a scenario where the database is updated not only by an eclipse
> link
> based application but by stored procedures as well. for that matter, I
> believe that we cannot make an assumption that the eclipse link is owning
> the database and operates on it in isolation.
> 
> So, if we use the increment value of the  sequence to the preallocation
> size
> defined on  the eclipse link entity definition, then there will be a lot
> of
>  sequence values unused.
> But if we set the increment value of the sequence to nominal 1, then there
> is every chance of collision with the values generated by sequence and
> that
> generated by eclipse link.
> 
> 
> Now my question is why can't the eclipse link update the sequence object
> by
> the preallocation size when ever it want to prefetch values? why is it
> updating only by the original increment size of the sequence even though
> it
> is presuming it acquired the amount o values mentioned in the
> preallocation
> size in the entity?
> 
> for example, had eclipse link done some thing like this:
> 
> on Oracle:
> 
> ALTER SEQUENCE SEQUENCE_NAME INCREMENT BY 'preallocation_size'; where ever
> eclipse link wanted to prefetch the values
> and then resetting it back to
> ALTER SEQUENCE SEQUENCE_NAME INCREMENT BY 'original_increment_value';
> 
> 
> then there can be no error at any point , who ever may update the database
> from any where as long as sequence is properly used.
> 
> Can this be achieved by any setting by which I can force elipselink to
> always update the sequence value by preallocation size and not the
> INCREMENT
> SIZE?
> 
> Thanks and Regards,
> Samba
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/How-eclipselink-handles-Sequences--tp26283654p26286010.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top