Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_cn
Articles_de
Articles_pt
Articles_zh
HibernateRelationshi...




JSPWiki v2.2.33

[RSS]


Hide Menu

HibernateRelationships


Difference between version 95 and version 94:

At line 55 added 1 line.
The ''many-to-one'' relationship between __Entry__ and __Category__ can be established using XDoclet tags. Hibernate relationships can be established on either side of the relationship or bi-directionally. For this tutorial, this relationship is maintained by a __categoryId__ property and a __Category__ object in __Entry__. The list of possible categories for a weblog entry will eventually be represented as a drop-down on the UI. Add the following code to your __Entry.java__ class.
At line 56 removed 4 lines.
The ''many-to-one'' relationship between __Entry__ and __Category__ can be established using XDoclet tags. Hibernate relationships can be established on either side of the relationship or bi-directionally. For this tutorial, this relationship will be maintained by an extra property and collection held by __Entry__. The list of possible categories for a weblog entry will eventually be represented as a drop-down on the UI. Add the following code to your __Entry.java__ class.
At line 91 changed 1 line.
Now you'll the __Weblog__ object and __Entry__ object to represent the multiplicity of a weblog that can have many entries. This relationship is set on the Weblog class using a java.util.List. XDoclet tags are used to establish this relationship using a __bag__ as the Hibernate collection type. Add the following code to your __Weblog.java__ class.
Now you'll modify the __Weblog__ object and __Entry__ object to represent the multiplicity of a weblog that can have many entries. This relationship is set on the Weblog class using a java.util.List. XDoclet tags are used to establish this relationship using a __bag__ as the Hibernate collection type. Add the following code to your __Weblog.java__ class.
At line 161 changed 1 line.
In addition to allow navigation from a Weblog object to their list of users, you need to add a Set of Weblogs to the User object - allowing that path of navigation as well. Modify ''User.java'' to add a ''weblogs'' Set and accessor methods. You might notice the __cascade="none"__ attribute. This is because this system doesn't currenly allow a weblog to be edited from the user screen and vise-versa. You'll change this in the section where you create the UI.
In addition, to allow navigation from a Weblog object to its list of users, you need to add a Set of Weblogs to the User object - allowing that path of navigation as well. Modify ''User.java'' to add a ''weblogs'' Set and accessor methods. You might notice the __cascade="none"__ attribute. This is because this system doesn't currenly allow a weblog to be edited from the user screen and vise-versa. You'll change this in the section where you create the UI.
At line 493 changed 1 line.
<property name="sessionFactory"><ref local="sessionFactory"/></property>
<property name="sessionFactory" ref="sessionFactory"/>
At line 498 changed 1 line.
<property name="sessionFactory"><ref local="sessionFactory"/></property>
<property name="sessionFactory" ref="sessionFactory"/>
At line 503 changed 1 line.
<property name="sessionFactory"><ref local="sessionFactory"/></property>
<property name="sessionFactory" ref="sessionFactory"/>

Back to HibernateRelationships, or to the Page History.