-->
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: Property to several columns in a custom type - default names
PostPosted: Tue Dec 06, 2005 10:24 pm 
Newbie

Joined: Tue Sep 16, 2003 3:26 pm
Posts: 8
Hi,

I'm currently trying to map a monetary amount property to several database columns using a CompositeUserType. Such as the docs say:

http://www.hibernate.org/hib_docs/annot ... c-property

Code:
@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")
@Columns(columns = {
    @Column(name="r_amount"),
    @Column(name="r_currency")
})
public MonetaryAmount getAmount() {
    return amount;
}


public class MonetaryAmount implements Serializable {
    private BigDecimal amount;
    private Currency currency;
    ...
}


Now, the problem is, this class is used A LOT in a big database. Maintaining @Columns annotations in each object propery is very error-prone (imagine 50 tables, maybe 30 monetary properties suchs athis).

So, is it possible to avoid the @Columns annotation by defining good default columns names? Such as with components and NamingStrategy? I guess it's the CompositeType job to define how many columns and what names should these columns take, right?

Is this planned in the current annotations spec? Or is there another way (other than using components) to do it?

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.