开发者

Java MySQL create a column to join multiple rows of another table's column

Java MySQL create a column to join multiple rows of another table's column:

In other words I would like to understand if it is possible to have MySQL Java object (e.g. class A)开发者_JAVA百科 that contains a list of references to istances of another object (e.g. class B).

Is ths possible? Which annotation should I use? (What I want to achieve by accessing to a field of an istance of class A to retrieve a list of references of istances of class B, the number of this is variable..).

I am using MySQL with Hibernate and SpringTool source (with Roo).

Many thanks!


If you are using Hibernate please try via the @OneToMany annotation. Working with collections is explained in this section:

http://docs.jboss.org/ejb3/app-server/HibernateAnnotations/reference/en/html_single/index.html#entity-mapping-association-collections

As you wrote, you are using Spring Roo. So you just have to type

field set ...

Refer to http://static.springsource.org/spring-roo/reference/html/command-index.html - Section A.12.8. (sorry, no HTML Anchor)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜