[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1112?page=c...
]
Eric Sirianni commented on HBX-1112:
------------------------------------
My reading of this is that this is not a bug in the Sybase driver, not in Hibernate.
For a composite primary key, it should be returning the same PK_NAME for each column
(since it is, after all, a single primary key). Instead it is returning different PK_NAMEs
for each column (namely the column name itself).
http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getP...
As a workaround, I created a class "SybaseAnywhereMetaDataDialect" that simply
returns null for PK_NAME (this is allowable in the JDBC spec -- see link above).
...
/*
* Sybase incorrectly returns the COLUMN_NAME for the PK_NAME
* This is incorrect when there is a composite primary key
*/
element.put("PK_NAME", null);
...
Reverse engineering problem with composite primary key
------------------------------------------------------
Key: HBX-1112
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1112
Project: Hibernate Tools
Issue Type: Bug
Affects Versions: 3.2.4 Beta1
Environment: configuration:
Hibernate Tools version: HibernateTools-3.2.4.CR2-R200901280154
Hibernate version: hibernate-3.2.6.ga.zip
Database: Sybase SQL Anywhere 10.0.1.3415
JDBC-Driver: jconnect 6.05
Eclipse Version: 3.4.0
Code Generation Configuration:
Use Java 5 syntax and generate EJB3 annotations switched on.
Exporters: domain code.
Reporter: Christian Meyer
Hello,
I have a problem reverse engineering domain code from a sybase anywhere 10 database.
For every table with composite primary key i get the following exception:
org.hibernate.cfg.JDBCBinderException: Duplicate names found for primarykey.
Her is one example:
create table DCALLS
(
AES timestamp default timestamp,
APPLID char(8) not null,
DIALOG integer not null,
COUNTER integer,
constraint PK_DCALLS primary key (APPLID, DIALOG)
);
For downloading developer edition of sybase anywhere version 10 follow the link:
http://marketing.ianywhere.com/forms/SQLAny10DevEditionCDReigster
I used a Hibernate dialect from the sybase homepage:
http://www.sybase.de/detail?id=1057826
org.hibernate.cfg.JDBCBinderException: Duplicate names found for primarykey.
Existing name: APPLID JDBC name: DIALOG on table
org.hibernate.mapping.Table(sybase10.DCALLS)
Duplicate names found for primarykey. Existing name: APPLID JDBC name: DIALOG on table
org.hibernate.mapping.Table(sybase10.DCALLS)
all Tables with single key are fine.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira