| At line 62 changed 1 line. |
| 这个类必须扩展[BaseObject|http://raibledesigns.com/downloads/appfuse/api/org/appfuse/model/BaseObject.java.html],而这个 |
| 这个类必须扩展[BaseObject|http://raibledesigns.com/downloads/appfuse/api/org/appfuse/model/BaseObject.java.html],而这个BaseObject有三个抽象方法(equals(), hashCode()和toString())需要你在Person类里实现,前两个是Hibernate的需要。为了完成这部分工作最简单的方式是使用[Commonclipse|http://commonclipse.sf.net],关于这个工具更多的信息可以在[Lee Grey的网站|http://www.leegrey.com/hmm/2004/09/29/1096491256000.html]里看到,另外一个你可以使用的Eclipse的插件是[Commons4E|http://commons4e.berlios.de/],我还没有使用过,这里不便对其功能作出评论。 |
| At line 64 changed 1 line. |
| BaseObject有三个抽象方法(equals(), hashCode() and toString())需要你在Person类里实现,前两个是Hibernate的需要。为了完成这部分 |
| ;:''如果你使用[IntelliJ IDEA|http://www.jetbrains.com/idea],你可以自动产生equals()和hashCode(),但没有toString(),有一个 [ToStringPlugin|http://www.intellij.org/twiki/bin/view/Main/ToStringPlugin]插件做得非常不错'' |
| At line 66 changed 1 line. |
| 工作最简单的方式是使用[Commonclipse|http://commonclipse.sf.net],关于这个工具更多的信息可以在[Lee Grey的网站 |
| 现在我们已经创建了这个POJO对象,我们需要增加XDoclet标记来产生Hibernate的映射文件,这些文件用来映射对象→ 表和属性(变量) → 字段。 |
| At line 68 changed 1 line. |
| |http://www.leegrey.com/hmm/2004/09/29/1096491256000.html]里看到,另外一个你可以使用的Eclipse的插件是 |
| 首先,我们增加[@hibernate.class|http://xdoclet.sourceforge.net/tags/hibernate-tags.html#@hibernate.class%20(0..1)] 来告诉Hibernate我们将要和那个表作关联: |
| At line 70 removed 14 lines. |
| [Commons4E|http://commons4e.berlios.de/],我还没有使用过,这里不便对其功能作出评论。 |
|
| ;:''如果你使用[IntelliJ IDEA|http://www.jetbrains.com/idea],你可以自动产生equals()和hashCode(),但没有toString(),有一个 |
|
| [ToStringPlugin|http://www.intellij.org/twiki/bin/view/Main/ToStringPlugin]插件做得非常不错'' |
|
| 现在我们已经创建了这个POJO对象,我们需要增加XDoclet标记来产生Hibernate的映射文件,这些文件用来映射对象→ 表和属性(变量) |
|
| → 字段。 |
|
| 首先,我们增加[@hibernate.class|http://xdoclet.sourceforge.net/tags/hibernate-tags.html#@hibernate.class%20(0..1)] 来告诉 |
|
| Hibernate我们将要和那个表作关联: |
|
| At line 92 changed 1 line. |
| We also have to add a primary key mapping or XDoclet will puke when generating the mapping file. Note that all @hibernate.* |
| We also have to add a primary key mapping or XDoclet will puke when generating the mapping file. Note that all @hibernate.* tags should be placed in the __getters'__ Javadocs of your POJOs. |
| At line 94 removed 2 lines. |
| tags should be placed in the __getters'__ Javadocs of your POJOs. |
|
| At line 109 changed 3 lines. |
| ;:%%(color: blue)''我使用{{generator-class="increment"}}而不使用{{generate-class="native"}} 是因为我对数据库使用"native"时[发 |
|
| 现了一些问题|AppFuseOnDB2],如果你只是希望使用MySQL,推荐使用"native"值__,本教程使用increment。''%% |
| ;:%%(color: blue)''我使用{{generator-class="increment"}}而不使用{{generate-class="native"}} 是因为我对数据库使用"native"时[发现了一些问题|AppFuseOnDB2],如果你只是希望使用MySQL,__推荐使用"native"值__,本教程使用increment。''%% |