-->
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: Mapping a single class to two tables? (using XDoclet)
PostPosted: Mon Jun 13, 2005 11:27 am 
Newbie

Joined: Mon Jun 13, 2005 10:48 am
Posts: 4
Yes, I'll confess up front that I'm a new user, but I have been trying to do my part reading up. I apologize in advance for my ignorance.

I tried to access the XDoclet tutorial at http://www.meagle.com:8080/hibernate.jsp but it wasn't found. There may be a better way of going about this, and any advice would be appreciated.

I have a class that has several fields that can are variable upon instantiation, and then remain fixed thereafter. The same class also has a small number of fields that continue to change after instantiation.

e.g. (only an example - not the real application)
    Class: Customer

    Name: fixed
    Address: fixed
    Telephone: fixed
    Balance: fluctuating

I want to record the state of the class through time, but I don't want to continually persist fields like Name Address and Telephone. I only need to record them once. Balance, on the other hand needs to be continually tracked. Is there a way to split the persistence into two different tables (i.e. a fixed table and a dynamic table)?

I have pre-existing POJOs and am trying to generate the XML using XDoclet for Hibernate. Looking at example 9.5.1 from Hibernate in action:

Code:
/**
* @hibernate.class
* table = "USERS"
*/


Is it only possible to map to one table? If yes, would the best solution be to extract the changing data to a new class, or is there a better one? If no, I must be missing the section on how to define different types of saves.

Thank you and again, my apologies for what is most likely basic material.


Top
 Profile  
 
 Post subject: @SecondaryTables
PostPosted: Mon Jun 13, 2005 4:32 pm 
Newbie

Joined: Mon Jun 13, 2005 10:48 am
Posts: 4
Answering my own question - it looks like the Beta release of the Hibernate Annotations provides a @SecondaryTables flag which accomplishes exactly what I was trying to describe (p.18 of the Beta2 documentation). I'm not sure if XDoclet has a similar capability or not, but the new annotations look like the way to go.


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.