Subject | Re: [Firebird-Java] Primary key column marked as unique in reverse-engineeringusing hibernate tools |
---|---|
Author | softed@gmail.com |
Post date | 2009-07-22T11:35:23Z |
Try with isql. Comes with the firebird in the bin directory.
isql -u sysdba -p yourPassword database.fdb -x -o databaseMetadata.sql
This command extract the metadata or DB definition to the file databaseMetadata.sql
isql -u sysdba -p yourPassword database.fdb -i databaseMetadata.sql
This command creates the database from the file databaseMetadata.sql
I hope this can help you
-----Original Message-----
From: Lester Caine <lester@...>
Date: Wed, 22 Jul 2009 06:27:15
To: <Firebird-Java@yahoogroups.com>
Subject: Re: [Firebird-Java] Primary key column marked as unique in reverse-engineering
using hibernate tools
vkozlov_tk wrote:
depends on which database engine you are using as I think MySQL at least needs
the unique=true. So perhaps the problem is with the recreate rather then the
reverse-engineering. In other cross database software, the 'datadict' side of
things has to compensate for these differences. It depends which bug you are
trying to fix?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
[Non-text portions of this message have been removed]
isql -u sysdba -p yourPassword database.fdb -x -o databaseMetadata.sql
This command extract the metadata or DB definition to the file databaseMetadata.sql
isql -u sysdba -p yourPassword database.fdb -i databaseMetadata.sql
This command creates the database from the file databaseMetadata.sql
I hope this can help you
-----Original Message-----
From: Lester Caine <lester@...>
Date: Wed, 22 Jul 2009 06:27:15
To: <Firebird-Java@yahoogroups.com>
Subject: Re: [Firebird-Java] Primary key column marked as unique in reverse-engineering
using hibernate tools
vkozlov_tk wrote:
> When I perform reverse-engineering of a Firebird database usingThe bug you list also contains part of the reason that it happens. This
> hibernate tools, the primary key column is annotated as unique:
>
> CREATE TABLE OBJCLASS (
> IDOBJCLASS INTEGER NOT NULL,
> NAME VARCHAR(250),
> SYSNAME VARCHAR(250) NOT NULL,
> IDOBJCLASSPARENT INTEGER
> );
> ALTER TABLE OBJCLASS ADD PRIMARY KEY (IDOBJCLASS);
>
> generates code for primary key:
>
> @SequenceGenerator(name = "generator", sequenceName = "GENERATOR_ID")
> @Id
> @GeneratedValue(strategy = SEQUENCE, generator = "generator")
> @Column(name = "IDOBJCLASS", unique = true, nullable = false)
> public Integer getIdobjclass() {
> return this.idobjclass;
> }
>
> and when I trying to recrerate database via hbm2ddl, the error occurs:
>
> 1485 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - GDS
> Exception. 335544351. unsuccessful metadata update
> Same set of columns cannot be used in more than one PRIMARY KEY and/or
> UNIQUE constraint definition
>
> The similar issue described here:
> http://opensource.atlassian.com/projects/hibernate/browse/HBX-978
>
> Is there any way to suppress generation of "unique = true" for PK
> column?
depends on which database engine you are using as I think MySQL at least needs
the unique=true. So perhaps the problem is with the recreate rather then the
reverse-engineering. In other cross database software, the 'datadict' side of
things has to compensate for these differences. It depends which bug you are
trying to fix?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
[Non-text portions of this message have been removed]