-->
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: one-to-one not using pk on either class
PostPosted: Fri Oct 29, 2004 9:32 am 
Newbie

Joined: Fri Oct 03, 2003 11:58 am
Posts: 14
I need to create a one-to-one relationship between the Device table and the Status table based on the Device.hostname and Status.hostname relationship.

The Status table is populated by an external application and is readonly to Hibernate.

Is one-to-one the way to do it? All of the documentation seems to point to the fact that one-to-one only supports the PK on the mapped class.

TIA

Hibernate version: 2.0

Mapping documents:
Device
Code:
<hibernate-mapping>
    <class name="Device" table="device">
        <cache usage="read-write"/>
        <id name="id" column="id" type="java.lang.Long" unsaved-value="null">
            <generator class="hilo">
                <param name="table">hi_value</param>
                <param name="column">next_value</param>
                <param name="max_lo">100</param>
            </generator>
        </id>
        <property name="hostname" type="java.lang.String" column="hostname" length="255" not-null="true" unique="true"/>
    </class>
</hibernate-mapping>


Status
Code:
<hibernate-mapping default-cascade="none">
    <class name="Status"
        table="status">
        <id name="hostname" type="java.lang.String" column="host_name">
            <generator class="assigned"/>
        </id>
        <property name="hostStatus" type="int" column="host_status" not-null="true" length="1"/>
    </class>
</hibernate-mapping>


Name and version of the database you are using: MySQL 3.21.x


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 01, 2004 9:30 am 
Newbie

Joined: Fri Oct 03, 2003 11:58 am
Posts: 14
Anyone have any ideas on this?


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.