Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
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  
 
 Post subject: Re: Hibernate/Seam....duplication of constraints.....
PostPosted: Tue May 04, 2010 12:28 pm 
Contributor
Contributor

Joined: Thu Mar 06, 2008 2:57 pm
Posts: 203
I try to reproduce using 2 tables:
CREATE TABLE md_business_unit
(
business_unit_id serial NOT NULL,
country_id integer NOT NULL,
cod_bu integer,
"name" character varying,
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
)
and
CREATE TABLE country
(
country_id serial NOT NULL,
CONSTRAINT md_country_id PRIMARY KEY (country_id)
)
it is not reproducible.
If you are sure this is a bug - report here https://jira.jboss.org/jira/browse/JBIDE.
Remember you should specify which is you versions of postgres, jdbc driver version, JBDS version.
For example: I use postgresql-8.3.3-1.zip, postgresql-8.3-603.jdbc2.jar, JBDS 3.1.0-CR2


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

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.