[jboss-user] [EJB 3.0] - OneToOne using a formula

jazir1979 do-not-reply at jboss.com
Wed Nov 8 20:44:56 EST 2006

Hi all,

I haven't found anything in the EJB3 spec that lets me do something like the "formula" attribute of Hibernate's <one-to-one>.  Does anybody know of a way to do this?

This stems from an I18N problem..

I have a one to many relationship between a table A and a Messages table that stores an attribute of A for each supported locale.  One thought I had was to model this as a Map collection, indexed by the locale - very nifty!

However, in cases where we know we only want a single value (for a given locale), it seems silly to populate the whole map.  So I thought a one-to-one with a formula condition would be a good idea, ala Hibernate (http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-declaration-onetoone).

Currently I'm thinking about an entity callback that populates a transient attribute using the current locale, but am hoping for something nicer..

any ideas would be much appreciated!

PS- I realise this question is more about the EJB3 spec than JBoss' implementation, but am not sure where else to ask?  :)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984359#3984359

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984359

More information about the jboss-user mailing list