-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Identity id's, many-to-one and Sybase ASE
PostPosted: Thu Feb 26, 2004 12:22 pm 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
This is probably something stupid I have missed but why does this happen?

I've got the id of my parent class setup like this:

Code:
    <class name="com.lehman.mis.model.AccountProfile" table="ACCOUNT_PROFILE">

        <id name="id" type="integer">
            <column name="ID" sql-type="numeric(10,0)"/>
            <generator class="identity"/>
        </id>

various properties....

        <!-- Bi-directional one-to-many -->
        <set name="clientAcronyms" cascade="all-delete-orphan" inverse="true">
            <key column="PARENT_ID""/>
            <one-to-many class="com.lehman.mis.model.ClientAcronyms"/>
        </set>

        <set name="budgetsAndCoverages" cascade="all-delete-orphan" inverse="true">
            <key column="PARENT_ID"/>
            <one-to-many class="com.lehman.mis.model.BudgetAndCoverage"/>
        </set>



And one of the child classes like this:

Code:

    <class name="com.lehman.mis.model.BudgetAndCoverage" table="ACCOUNT_BUDGET_AND_COVERAGE">

        <id name="id" type="integer">
            <column name="ID" sql-type="numeric(10,0)"/>
            <generator class="identity"/>
        </id>

        <!-- A bi-drectional mapping. A BudgetAndCoverage can't live without a Account Profile. -->
         <many-to-one name="parent" class="com.lehman.mis.model.AccountProfile" column="PARENT_ID" not-null="true"/>


And SchemaExport keeps insisting on generating INT for PARENT_ID in the children classes...

Shouldn't this be the same sql-type (numeric(10, 0)) ? My database thinks so...

I can't find a way to force Hibernate to generate the correct type since sql-type is not applicable to the key attribute in the set tag.

Or am I missing something trivial?

/Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 1:34 pm 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
This is the foreign key constraint that ShemaExport generates and my sql task in build.xml does not like.

Code:
      [sql] Failed to execute: alter table ACCOUNT_BUDGET_AND_COVERAGE add const
raint FK8FE430F8217F38D0 foreign key (PARENT_ID) references ACCOUNT_PROFILE
      [sql] com.sybase.jdbc2.jdbc.SybSQLException: Column types of referencing a
nd referenced columns don't match. referencing column = 'PARENT_ID', referenced
column = 'ID'.



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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.