Hi, One further question: How are you going to get the ID of the newly inserted feature back to OpenJUMP side?
-Jukka- -----Original Message----- From: Kevin Neufeld [mailto:kneuf...@refractions.net] Sent: Mon 6.9.2010 9:35 To: OpenJump develop and use Subject: Re: [JPP-Devel] wishlist Hi Jukka, Yes, inserts are more tricky than other modification types. However, IMHO, a properly modeled database will include sequence generators, rules, or triggers on database tables enforcing the primary key attribute. My first iteration through this will be to simply target the most common use case, that is, during an insert operation, specify all attributes except the primary key (whether single or multi-column key) and let the database populate the field(s) automatically. If the attempt fails, then there are options: 1) Do nothing, rollback the transaction and notify the user they are missing sequences on their primary key columns 2) Again, warn the user their database modeling needs work and try the commonly used max(ID) approach to guess the primary key entry (maybe in a confirmation dialog). However, this is definitely not recommended. What if the column is alphanumeric? What's the max(ID) then? What if it's, as you point out, a multiple-key column? Obviously we can't guess that. What if it was intentional that a sequence was not provided? Maybe the table is considered read-only. No, this approach makes assumptions about the datamodel that a viewing/editing tool really should not be making. I think for now, I'm going to stick with simply relying on the the fields to be auto-generated. Cheers, Kevin On 9/4/2010 1:41 AM, Rahkonen Jukka wrote: > Hi, > > How are you going to deal with inserts? And have you considered supporting > also other databases than PostGIS (Oracle, Spatialite)? I have been dealing > with WFS-T against Oracle and I know that inserts are the most tricky part, > especially with Oracle. But it may be tricky even with PostGIS if table has a > combined primary key. > > Perhaps the not-so-recommended Geoserver way could be used? Geoserver selects > max(ID) in the beginning of insert, and feeds in ID=(max(ID)+1). It is not > recommended because it is not reliable at all if there are many users doing > inserts at the same time. The better way is to use triggers but it goes more > complicated. > > -Jukka Rahkonen- > ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel