-->
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: need help, converting simple mapping to annotation
PostPosted: Mon Dec 21, 2009 1:39 pm 
Newbie

Joined: Mon Dec 14, 2009 5:38 am
Posts: 13
Hello, I have a mapping here,
but I don't know how to create the annotation (I don't want to use hbm.xml mapping)
please help me:

Code:
<hibernate-mapping>
  <class name="willow.ExchangeRate" table="exchange_rates">
    <id name="id">
      <generator class="native"/>
    </id>
    <property name="moduser"/>
    <property name="moddate" type="timestamp"/>
    <property name="date" type="timestamp"/>
    <many-to-one class="willow.Currency" column="currency" name="currency" not-found="ignore"/>
    <property name="value"/>
  </class>

  <class name="willow.Currency" table="currencies">
    <id name="id">
      <generator class="native"/>
    </id>
    <property name="moduser"/>
    <property name="moddate" type="timestamp"/>
    <property name="currency_id"/>
    <property name="name"/>
    <property name="symbol"/>
  </class>
</hibernate-mapping>


thank you


Top
 Profile  
 
 Post subject: Re: need help, converting simple mapping to annotation
PostPosted: Mon Dec 21, 2009 1:54 pm 
Newbie

Joined: Mon Dec 14, 2009 5:38 am
Posts: 13
Well, after went through @JoinTable and @JoinColumn, I ended up with somewhat "simple" lines:

Code:
@ManyToOne
@JoinColumn(name="currency")
public Currency getCurrency() {
  return currency;
}


although my problem is solved, but I don't know the meaning behind this.
because from the line above, I can't see the target table (which is "currencies");
please someone explain to me....


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.