[jboss-user] [EJB 3.0] - Problem with java.util.Map in Entity Bean
pKraemer
do-not-reply at jboss.com
Wed Apr 11 10:47:31 EDT 2007
Well, I'm a bit confused how to solve this problem:
I have got two tables in my database:
|
| Table1:
| -----------------------
| -- locale_text --
| -- --
| -- PK locale --
| -- PK,FK test_id --
| -- text --
| -----------------------
|
| Table2:
| -----------------------
| -- test --
| -- --
| -- PK test_id --
| -- --
| -- --
| -----------------------
|
Table locale contains text in different languages.
Now there is only one Entity Bean for table2 which inlcudes a java.util.Map locale_text. This Map is represented by table1
I tried to solve it with secondaryTable an @MapKey but it does not work
EntityBean:
| @Entity
| @Table(name="test")
| @SequenceGenerator(name = "test_sequence", sequenceName = "test_id_seq")
| @SecondaryTable(name="i18n_test",
| pkJoinColumns={
| @PrimaryKeyJoinColumn(name="t_id",referencedColumnName="t_id")
| })
| public class Test implements Serializable {
|
| private static final long serialVersionUID = -8939291842604811925L;
|
| @Id
| @Column(name="t_id")
| @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
| "test_sequence")
| private java.lang.Long id;
|
| //Here is my problem
| @Column(table="i18n_test",name="locale")
| @MapKey(name="locale")
| private Map<java.util.Locale,java.util.Locale> localizedText =
| new HashMap();
|
| ....
| }
|
Happy for any help and/or ideas
thx
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036397#4036397
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036397
More information about the jboss-user
mailing list