Re: [Dhis2-devs] Last hibernate sequence value

2015-01-17 Thread Knut Staring
I agree this is tricky and there should be examples and correction in the docs. Please go ahead and update the docs. I mentioned Excel because many people have their data in that format, and it's easy to either create csv in excel or create text strings with the required xml code, which can then

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-17 Thread Morten Olav Hansen
I just want to mention that we also have /api/schemas This endpoint is a dynamic representation of what is allowed or not according to the schema (hibernate) You can not send any payload to this endpoint right now, but in 2.18 you can send your payload to I.e. /api/schemas/dataElement and get a

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Lars Helge Ă˜verland
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.row...@gmail.com wrote: Hi Devs

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Jason Pickering
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,

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Bob Jolliffe
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

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Greg Rowles
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

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Greg Rowles
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.row...@gmail.com wrote: Thanks Bob, Jason Others I agree and understand but we have a DHIS2 implementors who prefer to work directly inside

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Knut Staring
I assume you are talking about entering Metadata, correct? Like data elements or orgunits? What is the interface you are proposing to give them? Will you have a form with some kinds of restrictions? Are you thinking to link Postgres into Access via ODBC? Will there be multiple simultaneous

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Knut Staring
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

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Greg Rowles
Thank you Everyone, that leaves our db managers with 3 options then! On Fri, Jan 16, 2015 at 11:29 AM, Knut Staring knu...@gmail.com 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

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Calle Hedberg
Hi, You guys are all correct when saying that it's best to use the standard tools and/or the web api - the problem is that DHIS2 processing is rather opaque and/or the interface simply do not allow updating things (try accessing the OrgUnitLevel table if it's empty). Example: the other day I

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Bob Jolliffe
Agree Calle. I too have had to make use of the database directly to deal with some things which are just more difficult or not implemented in the api. So the point is just that if you are making sql insert queries then you should make use of the nextval function as described by Jason above to

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Bob Jolliffe
Truncated example: INSERT INTO organisationunit (organisationunitid, name, other fields ...) values (nextval('hibernate_sequence'), 'Bob's Clinic', ...); Aside: I am not sure why this is not defined as a default value like: create table example ( id int

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Knut Staring
To be frank, it doesn't really matter what you use for I'd as long as it is always smaller than the nextval of the hibernate sequence. But in order to ensure that, it is best practice to use it. On Jan 16, 2015 11:57 AM, Bob Jolliffe bobjolli...@gmail.com wrote: Agree Calle. I too have had to

Re: [Dhis2-devs] Last hibernate sequence value

2015-01-16 Thread Calle Hedberg
Hi, FYI, Lars finally got back to me on those examples I sent him: (a) confirming that using Excel for editing XM does not work; (b) pointing out that the reason for my CSV file not working was incorrect field sequence. Point (b) highlights a fundamental (and frequent) problem with the standard