-->
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: Annotation Support Needed
PostPosted: Thu Dec 06, 2007 5:05 am 
Newbie

Joined: Thu Dec 06, 2007 4:37 am
Posts: 1
Hi,

I try to implement i18n support and I found this solution in the web:

http://www.jroller.com/craiger/entry/po ... _i18n_with

It's more or less this:

a) you have a table eg. product with the columns: id | name | name_fr | name_de ...
b) you create a bo:
Code:
@Entity
@Table(name = "products")
public class Product implements Serializable {
   private long id;
   protected String name;
   
   public static class Product_fr extends Product {
      public Product_fr(){
         super();
      }
               
      @Column(name="name_fr")           
      public String getName(){
          return name;
      }
   }

   // Product_de

   // ID

   @Column(nullable = false)
   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }
}

c) you map Product$Product_fr#name to name_fr column.
d) now in your DAO you search the language class inside the original class according to the language using in your application and now you can set the name-property the same way as it wasn't translated. (Product.get/setName).

Now my question is, how can I do this with annotations. Do I have to override getName() in the subclasses and add a (eg.) @Column(name="product_fr") annotation to each getter? (Like I did it)

Thanks for your reply!

logan


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.