-->
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.  [ 1 post ] 
Author Message
 Post subject: Composite key of an <any>?
PostPosted: Thu Jul 14, 2005 12:51 am 
Newbie

Joined: Wed Jun 29, 2005 12:49 pm
Posts: 4
In short: Is it possible to have the two columns of an <any> relationship be a composite key?

More detailed:
When I was looking through the test code, I found this nice little example of how to use a formula and a one-to-one:
Code:
...
        <class name="Person">
                <id name="name"/>
                <one-to-one name="address" cascade="all" constrained="false">
                        <formula>name</formula>
                        <formula>'HOME'</formula>
                </one-to-one>
                <one-to-one name="mailingAddress" constrained="false">
                        <formula>name</formula>
                        <formula>'MAILING'</formula>
                </one-to-one>
        </class>

        <class name="Address" batch-size="2"
                        check="addressType in ('MAILING', 'HOME', 'BUSINESS')">
                <composite-id>
                        <key-many-to-one name="person" column="personName"/>
                        <key-property name="type" column="addressType"/>
                </composite-id>
                <property name="street" type="text"/>
                <property name="state"/>
                <property name="zip"/>
        </class>


Is this possible to do with an <any> relationship? Something like (I'm totally making this up):
Code:
        <class name="Address">
                <composite-id>
                        <key-property name="type" column="addressType"/>     
                        <key-property name="key" column="addressKey"/>
                </composite-id>
                <any name="owner" id-type="string" meta-type="string">
                     <meta-value value="USER" class="org.argyle.core.domain.User"/>
                     <column name="addressType"/>
                     <column name="addressKey"/>
                </any>
        </class>


Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.