-->
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: Reference of class property in composite-element
PostPosted: Wed Feb 16, 2011 10:17 am 
Newbie

Joined: Wed Feb 16, 2011 10:02 am
Posts: 1
Hi. I have a couple of classes:
Code:
public class Bar {
     private String text;
}

public class Foo {
    private String text;
    private Date date;
    private List<Bar> bars;
}


Now, I want to put Foo in one table and Bar in another table. That is easy enough. But I would like to bring the timestamp from Foo into the table of Bar as well so it is possible to partition both tables. However, this is an old datamodel, and I am unable to rewrite it so as to put a date field into Bar. Is it possible to map the date-field of Foo so that it will also be a part of the Bar-table, or is this not possible?

I am imagining something like this:
Code:
<class name="Foo">
    <id name="text" column="FOO_TEXT" />
    <property name="date" />
     ......
    <list name="bars">
        <key column="FOO_TEXT" />
        <composite-element>
             <property name="text" />
             <!-- Reference to date in Foo -->
             <ref name="Foo.date" column="DATE" />
        </composite-element>
    </list>
</class>


Not sure if this makes sense or not, but as I said, the model I work with is old and making changes could be complicated and the possibility for partitioning would be convenient.

Thanks in advance


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.