Hi all...i'm a newbie to hibernate so sorry for any mistake or for slowly understanding you.....
Btw...my situation is this:
Running Hibernate + Seam from an existing db, to build the crud application to access and modify data in tables..... Working with eclipse, with seam (and hibernate obviously) in it.....
My process: I start creating a "seam web project" and configuring the access to db (postgres).....then i run hibernate trough "Hibernate Code Generation Configuration", setting up configurations, and reveng.xml as i want my entities to be named, jdbc types and so on......then i see all my entities created correctly in the right positions.....
The problem: When i run "Seam Generate Entities", with the setting "from existing entities" i see that it (or hibernate?) creates copies of my foreign keys in my db! For example: this is my "clean" table..... CREATE TABLE md_business_unit ( business_unit_id serial NOT NULL, country_id integer NOT NULL, cod_bu integer, name character varying(255), CONSTRAINT md_business_unit_pkey PRIMARY KEY (business_unit_id), CONSTRAINT md_business_unit_country_id_fkey FOREIGN KEY (country_id) REFERENCES country (country_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION )
this is my table after running seam generate entities..... CREATE TABLE md_business_unit ( business_unit_id serial NOT NULL, country_id integer NOT NULL, cod_bu integer, name character varying(255), CONSTRAINT md_business_unit_pkey PRIMARY KEY (business_unit_id), CONSTRAINT fk1bad75fb37d32e0e FOREIGN KEY (country_id) REFERENCES country (country_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk1bad75fb3c517e3c FOREIGN KEY (country_id) REFERENCES country (country_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk1bad75fb45214f46 FOREIGN KEY (country_id) REFERENCES country (country_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT md_business_unit_country_id_fkey FOREIGN KEY (country_id) REFERENCES country (country_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION )
so...can u tell me what am i doing wrong? i tried and tried billions of configurations, in persistence.xml, seam wizards and so on....- disperated - hihi....
thanks all in advance!
|