[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-731) All the fields are marked as <key-property> in <composite-id>

Al Dev (JIRA) noreply at atlassian.com
Fri Aug 18 09:30:18 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-731?page=comments#action_23982 ] 

Al Dev commented on HBX-731:
----------------------------

Thanks for your comments:
It is extremely difficult for me to add Primary Keys to the table, because the tables are created by  3rd party vendor and I do not have any access to doing modifications.

I highly recommend to add another fallback if there is a unique index declared.

Who is the developer who works on this module?

> All the fields are marked as <key-property> in <composite-id>
> -------------------------------------------------------------
>
>          Key: HBX-731
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-731
>      Project: Hibernate Tools
>         Type: Bug

>  Environment: Hibernate Tools 3.1.0.beta5
> MS Windows, Oracle 9i server
>     Reporter: Al Dev

>
>
> All the fields are marked as <key-property> in <composite-id>
> in the Scbcrse.hbm.xml file. How come the tool is not picking up the unique index  key fields in the database table?
> What I expect from the hibernate tool is that it should not the unique key indexes created for the database table and 
> based on that it should make the <composite-id>  fields. 
> It looks like the tool is completely ignoring the unique key indexes created on the table.
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
> <!-- Generated Aug 16, 2006 4:23:47 PM by Hibernate Tools 3.1.0.beta5 -->
> <hibernate-mapping>
>     <class name="edu.sjcd.hibernate.oracle.ScbcrseMy" table="SCBCRSE" schema="SATURN">
>         <composite-id name="id" class="edu.sjcd.hibernate.oracle.generated.ScbcrseId">
>             <key-property name="scbcrseSubjCode" type="string">
>                 <column name="SCBCRSE_SUBJ_CODE" length="4" />
>             </key-property>
>             <key-property name="scbcrseCrseNumb" type="string">
>                 <column name="SCBCRSE_CRSE_NUMB" length="5" />
>             </key-property>
>             <key-property name="scbcrseEffTerm" type="string">
>                 <column name="SCBCRSE_EFF_TERM" length="6" />
>             </key-property>
>             <key-property name="scbcrseCollCode" type="string">
>                 <column name="SCBCRSE_COLL_CODE" length="2" />
>             </key-property>
>             <key-property name="scbcrseDivsCode" type="string">
>                 <column name="SCBCRSE_DIVS_CODE" length="4" />
>             </key-property>
>             <key-property name="scbcrseDeptCode" type="string">
>                 <column name="SCBCRSE_DEPT_CODE" length="4" />
>             </key-property>
>         </composite-id>
>     </class>
> </hibernate-mapping>
> I have table in oracle which has fields like this:
> CREATE TABLE SATURN.SCBCRSE
> (
>   SCBCRSE_SUBJ_CODE             VARCHAR2(4 BYTE) NOT NULL,
>   SCBCRSE_CRSE_NUMB             VARCHAR2(5 BYTE) NOT NULL,
>   SCBCRSE_EFF_TERM              VARCHAR2(6 BYTE),
>   SCBCRSE_COLL_CODE             VARCHAR2(2 BYTE),
>   SCBCRSE_DIVS_CODE             VARCHAR2(4 BYTE),
>   SCBCRSE_DEPT_CODE             VARCHAR2(4 BYTE)
> )
> CREATE UNIQUE INDEX SATURN.SCBCRSE_KEY_INDEX ON SATURN.SCBCRSE
> (SCBCRSE_SUBJ_CODE, SCBCRSE_CRSE_NUMB, SCBCRSE_EFF_TERM)
> And I have the reveng.xml as :
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
> <hibernate-reverse-engineering>
> <schema-selection match-schema="SATURN" />
> <type-mapping>
> 	<sql-type jdbc-type="NUMERIC" precision="22" scale="0" hibernate-type="long" />
> </type-mapping>
> 	<table-filter match-name="SCBCRSE.*" />
> </hibernate-reverse-engineering>

-- 
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