Ok,
so this will be my query:
INSERT INTO organisationunit(organisationunitid, shortname, "name", 
geocode) VALUES ( nextval('hibernate_sequence') ,  '?',  '?',  ?)
etc.. etc...

the problem is for source table (and it is right!!!):
ERROR: insert or update on table "organisationunit" violates foreign key 
constraint "fke509dd5ef1c932ed"
Stato SQL: 23503
Dettaglio:Key (organisationunitid)=(14775) is not present in table "source".

Must I operate before on source table and insert sourceID ?

Lars Helge Øverland ha scritto:
>
>
> On Tue, Oct 28, 2008 at 5:08 PM, Fabio D'Ovidio 
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hello.
>     I'm trying to map my new data in geoserver to DHIS in
>     organisationunit table
>     My mapping.xml is as following for new layers:
>
>     <util:map id="locationToLayerMap">
>
>          <entry key="[Location].[OrgUnit5]" value="who:regioni"/>
>          <entry key="[Location].[OrgUnit6]" value="who:province"/>
>          <entry key="[Location].[OrgUnit7]" value="who:comuni"/>
>        </util:map>
>
>        <util:map id="locationToGeocodedPropertyNameMap">
>
>          <entry key="[Location].[OrgUnit5]" value="cod_reg"/>
>          <entry key="[Location].[OrgUnit6]" value="cod_pro"/>
>          <entry key="[Location].[OrgUnit7]" value="pro_com"/>
>        </util:map>
>
>     Now I want to put using kettle cod_reg and name values of my SHP
>     file in
>     oranisationunit table..something like:
>
>     INSERT INTO organisationunit(organisationunitid, shortname, "name",
>     geocode) VALUES ( 0,  'PIEMONTE',  'PIEMONTE',  1)
>     etc...etc...
>
>     the problem is: how can I set value in order to not violate constrains
>     on foreign key? (in particular on parentid and organisationunitid
>     field)?
>
>     Thank u !
>
>
> The organisationunit id auto-increment field depends on the database, 
> for postgres you can use  nextval('hibernate_sequence')  , for mysql 
> you can simply omit the field.
> The parentid field can simply be omitted, or you can insert the parent 
> first and then use the generated identifier.
>
> Lars
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Dhis-users mailing list
> [email protected]
> http://www.hisp.info/mailman/listinfo/dhis-users
>   

-- 
Fabio D'Ovidio
Geospatial solutions

INOVA s.r.l.
Web : http://www.inovaos.it
Tel.: 081 197 57 600
mail: [EMAIL PROTECTED]

_______________________________________________
Dhis-users mailing list
[email protected]
http://www.hisp.info/mailman/listinfo/dhis-users

Reply via email to