Hi guys,
I am trying to save an object into the database using PostgresqlPlugIn.framework provided by Wonder.
I am getting this error: java.lang.IllegalStateException: Adaptor com.webobjects.jdbcadaptor.JDBCAdaptor@be9d36 failed to provide new primary keys for entity 'Parametros' at com.webobjects.eoaccess.EODatabaseContext.prepareForSaveWithCoordinator(EODatabaseContext.java:5885) at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:409) at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3226) at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:981) at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:903) at com.toracom.erp.db.Parametros.inicializaParametros(Parametros.java:143) at com.toracom.erp.general.Application.<init>(Application.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at java.lang.Class.newInstance0(Class.java:350) at java.lang.Class.newInstance(Class.java:303) at com.webobjects.appserver.WOApplication.main(WOApplication.java:323) at er.extensions.appserver.ERXApplication.main(ERXApplication.java:632) at com.toracom.erp.general.Application.main(Application.java:29)
this is the first time I using wonder.
This is the sql code generated by Entity Modeler
CREATE TABLE parametros ( parametros_id int4 NOT NULL, calle varchar NOT NULL, ciudad varchar NOT NULL, codigo_postal varchar NOT NULL, colonia varchar NOT NULL, email_formato varchar NOT NULL, estado varchar NOT NULL, fax varchar , fax_lada varchar , fh varchar NOT NULL, fhc varchar NOT NULL, formato_numero_registro_bd varchar(20) NOT NULL, formato_numero_registro_bd_corto varchar(20) NOT NULL, fsh varchar NOT NULL, fshnm varchar NOT NULL, iva numeric(4,4) NOT NULL, logs_debug varchar(5) NOT NULL, logs_path varchar , logs_stdout varchar(5) NOT NULL, look_t_r_b_anidado_color varchar(20) NOT NULL, look_t_r_b_anidado_estilo varchar(20) NOT NULL, look_t_r_b_captura_color varchar(20) NOT NULL, look_t_r_b_captura_estilo varchar(20) NOT NULL, look_t_r_b_control_color varchar(20) NOT NULL, look_t_r_b_control_estilo varchar(20) NOT NULL, look_t_r_b_en_tab_color varchar(20) NOT NULL, look_t_r_b_en_tab_estilo varchar(20) NOT NULL, look_t_r_b_login_color varchar(20) NOT NULL, look_t_r_b_login_estilo varchar(20) NOT NULL, nd varchar(20) NOT NULL, ne varchar(20) NOT NULL, nm varchar(20) NOT NULL, nombre_aplicacion varchar NOT NULL, nombre_comercial varchar NOT NULL, np varchar(20) NOT NULL, ntc varchar(20) NOT NULL, numero_exterior varchar NOT NULL, numero_interior varchar , pagina_web varchar , pais varchar NOT NULL, permite_multiple_monedas varchar(5) , razon_social varchar NOT NULL, rfc varchar NOT NULL, rfc_fisica varchar NOT NULL, rfc_moral varchar NOT NULL, sistema_inicializado smallint NOT NULL, telefono varchar , telefono_lada varchar );
CREATE SEQUENCE parametros_seq;
CREATE TEMP TABLE EOF_TMP_TABLE AS SELECT SETVAL('parametros_seq', (SELECT MAX(parametros_id) FROM parametros));
ALTER TABLE parametros ALTER COLUMN parametros_id SET DEFAULT nextval( 'parametros_seq' );
ALTER TABLE parametros ADD CONSTRAINT parametros_pk PRIMARY KEY (parametros_id);
And the code I am using to create and save the object is
Parametros parametros = Parametros.createParametros(ec, false); ec.saveChanges(); In the awakeFromInsertion(EOEditingContext ec) method of my Parametros Entity I initialize all required attributes.
I am not even seeing any debug log with an INSERT query, as you can see there is a SELECT query because the first time the app runs it evaluates if the Parametros Table is empty, which case it should insert a row in the table.
Jul 22 20:50:54 erp[55559] DEBUG NSLog - evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT DISTINCT t0.calle, t0.ciudad, t0.codigo_postal, t0.colonia, t0.email_formato, t0.estado, t0.fax, t0.fax_lada, t0.fh, t0.fhc, t0.formato_numero_registro_bd, t0.formato_numero_registro_bd_corto, t0.fsh, t0.fshnm, t0.iva, t0.logs_debug, t0.logs_path, t0.logs_stdout, t0.look_t_r_b_anidado_color, t0.look_t_r_b_anidado_estilo, t0.look_t_r_b_captura_color, t0.look_t_r_b_captura_estilo, t0.look_t_r_b_control_color, t0.look_t_r_b_control_estilo, t0.look_t_r_b_en_tab_color, t0.look_t_r_b_en_tab_estilo, t0.look_t_r_b_login_color, t0.look_t_r_b_login_estilo, t0.nd, t0.ne, t0.nm, t0.nombre_aplicacion, t0.nombre_comercial, t0.np, t0.ntc, t0.numero_exterior, t0.numero_interior, t0.pagina_web, t0.pais, t0.parametros_id, t0.permite_multiple_monedas, t0.razon_social, t0.rfc, t0.rfc_fisica, t0.rfc_moral, t0.sistema_inicializado, t0.telefono, t0.telefono_lada FROM parametros t0"> Jul 22 20:50:54 erp[55559] DEBUG NSLog - 0 row(s) processed Jul 22 20:50:54 erp[55559] DEBUG NSLog - === Commit Internal Transaction
After this I see the error reported above.
Any help will be appreciated.
|