[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-978) unique=true attribute of primary key in generated class prevents the schema to be regenerated
Hardy Ferentschik (JIRA)
noreply at atlassian.com
Fri Sep 18 04:46:50 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33983#action_33983 ]
Hardy Ferentschik commented on HBX-978:
---------------------------------------
This is not only a problem when reverse engineering. There were several problems with unit tests in Annotations where I had to change the used entity mappings due to the fact that the generated DDL scripts were adding an additional unique clause for primary key columns.
The mappings were not wrong per se and the tests would actually pass on most databases, except Oracle and Sybase.
Here is the link to the issue - https://jira.jboss.org/jira/browse/JBPAPP-1075 (the comments are partly misleading)
> unique=true attribute of primary key in generated class prevents the schema to be regenerated
> ---------------------------------------------------------------------------------------------
>
> Key: HBX-978
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-978
> Project: Hibernate Tools
> Issue Type: Bug
> Environment: OS: Windows Vista 6.0,x86
> Database: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
> Java VM: Java HotSpot(TM) Server VM 1.5.0_11-b03,Sun Microsystems Inc.
> Eclipse Europa: Version: 3.3.0 Build id: I20070621-1340
> HibernateTools-3.2.0.beta10
> Reporter: Ali Sadik Kumlali
> Priority: Minor
> Attachments: hbx-978.patch
>
>
> Hi,
> When I reverse engineer against Oracle, unique=true attribute is added to @Column annotation of primary key column. But, when I generate schema from these generated files, Oracle throws "ORA-02261: such unique or primary key already exists in the table" error.
> I first ran into this situation while trying Seam and posted the problem to Seam's forum: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=116478. After I got the response, decided to try it without Seam. Then, downloaded the latest HibernateTools & Eclipse Europa and reverse engineered the schema. I saw that generated classes have unique=true attribute which clearly showed that the problem was related with HibernateTools, not with Seam.
> Here is the DDL of the table against which I made my test:
> CREATE TABLE PEOPLE ("ID" NUMBER NOT NULL, "SURNAME" VARCHAR2(50 BYTE), "NAME" VARCHAR2(25 BYTE), CONSTRAINT "PEOPLE_PK" PRIMARY KEY ("ID"));
> Regards,
> Ali Sadik Kumlali
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list