-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate/Seam....duplication of constraints.....
PostPosted: Mon Mar 15, 2010 12:36 pm 
Newbie

Joined: Mon Mar 15, 2010 12:04 pm
Posts: 1
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.