← Back to team overview

dhis2-devs team mailing list archive

Re: Last hibernate sequence value

 

Thank you Everyone, that leaves our db managers with 3 options then!

On Fri, Jan 16, 2015 at 11:29 AM, Knut Staring <knutst@xxxxxxxxx> wrote:

> Yeah, that was my key question - and I thing it could work ok that way.
> But I would think you could achieve most of what you want through preparing
> things in Excel and then using the Metadata import instead (so you don't
> have to worry about the internal database IDs)
>
> On Fri, Jan 16, 2015 at 9:25 AM, Greg Rowles <greg.rowles@xxxxxxxxx>
> wrote:
>
>> Let me not forget to mention that this type of work would be preparatory
>> and not after roll out...
>>
>> On Fri, Jan 16, 2015 at 11:20 AM, Greg Rowles <greg.rowles@xxxxxxxxx>
>> wrote:
>>
>>> Thanks Bob, Jason & Others
>>>
>>> I agree and understand but we have a DHIS2 implementors who prefer to
>>> work directly inside the DBMS who are still new to this complex
>>> environment. If they need to insert records directly into tables this gives
>>> them the opportunity to do the work they're used to (coming from version
>>> 1.4)...
>>>
>>> Regards,
>>> Greg
>>>
>>>
>>> On Fri, Jan 16, 2015 at 11:17 AM, Bob Jolliffe <bobjolliffe@xxxxxxxxx>
>>> wrote:
>>>
>>>> Jason is right.  You should only need the hibernate sequence number if
>>>> you are dealing with the database through sql. And if you are, then the
>>>> only safe way to use it is to get the sequence during the execution of the
>>>> statement.
>>>>
>>>> Getting the next sequence number and storing it to some variable with
>>>> the aim of using it at some time in the future is inherently fragile.
>>>>
>>>> On 16 January 2015 at 09:10, Jason Pickering <
>>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>>
>>>>> Hi Greg,
>>>>> I would tend to agree with Lars that this should really not ever be
>>>>> required, but it would be good to know what the use case actually is.
>>>>>
>>>>> The easiest way to do this would be to create an SQL view in DHIS2 as
>>>>>
>>>>> SELECT currval('hibernate_sequence')
>>>>>
>>>>>
>>>>> In a multi-user database environment, this value is of course
>>>>> volatile, so you can never be sure what the actual current value is.
>>>>>
>>>>> If you really need to inject SQL into your database, then using
>>>>> something like 'nextval('hibernate_sequence'::regclass)'in your SQL,
>>>>> which will provide the next value of the sequence.
>>>>>
>>>>> Regards,
>>>>> Jason
>>>>>
>>>>> On Fri, Jan 16, 2015 at 9:49 AM, Lars Helge Øverland <
>>>>> larshelge@xxxxxxxxx> wrote:
>>>>>
>>>>>> Hi Greg,
>>>>>>
>>>>>> that would be easy to implement, but the idea is that it should never
>>>>>> be necessary to expose database details and instead work with the API. Do
>>>>>> you think you could elaborate a bit on the use-case?
>>>>>>
>>>>>> Lars
>>>>>>
>>>>>>
>>>>>> On Fri, Jan 16, 2015 at 8:35 AM, Greg Rowles <greg.rowles@xxxxxxxxx>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Devs
>>>>>>>
>>>>>>> Is there an easy way to expose the last hibernate sequence value
>>>>>>> through the web API?
>>>>>>>
>>>>>>> Greg
>>>>>>>
>>>>>>> --
>>>>>>> *Health Information Systems Program - South Africa*
>>>>>>> *- - - - - - - **- - - - - - - **- - - - - - - **- - - - - - - **-
>>>>>>> - - - - *
>>>>>>> Mobile  :    073 246 2992
>>>>>>> Landline:   021 554 3130
>>>>>>> Fax:          086 733 8432
>>>>>>> Skype:      gregory_rowles
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Jason P. Pickering
>>>>> email: jason.p.pickering@xxxxxxxxx
>>>>> tel:+46764147049
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>
>>>
>>> --
>>> *Health Information Systems Program - South Africa*
>>> *- - - - - - - **- - - - - - - **- - - - - - - **- - - - - - - **- - -
>>> - - *
>>> Mobile  :    073 246 2992
>>> Landline:   021 554 3130
>>> Fax:          086 733 8432
>>> Skype:      gregory_rowles
>>>
>>
>>
>>
>> --
>> *Health Information Systems Program - South Africa*
>> *- - - - - - - **- - - - - - - **- - - - - - - **- - - - - - - **- - - -
>> - *
>> Mobile  :    073 246 2992
>> Landline:   021 554 3130
>> Fax:          086 733 8432
>> Skype:      gregory_rowles
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> Liberia: +231 770 496 123 or +231 886 146 381
> Norway: +4791880522
> Skype: knutstar
> http://dhis2.org
>



-- 
*Health Information Systems Program - South Africa*
*- - - - - - - **- - - - - - - **- - - - - - - **- - - - - - - **- - - - - *
Mobile  :    073 246 2992
Landline:   021 554 3130
Fax:          086 733 8432
Skype:      gregory_rowles

Follow ups

References