(翻译)Spring到Java EE的迁移(一)__续
续前节。
?
我们看到,NetBeans通过自动生成JPA实体为我们节省了大量时间。?“Don’t use wizard code you don’t understand.”———Andrew Hunt and Dave Thomas
?
咱们看看生成的实体代码,你自己理解一下。
Listing 1. Examining a Generated Entity
package com.ensode.petclinicjavaee.entity; ? //imports omitted for brevity ?
这些代码很平淡,很俗,只是标准JavaBean,带着私有属性和公开的getter和setter.关键是注解。.(对注解的理解请看原文http://www.oracle.com/technetwork/articles/java/springtojavaee-522240.html)
?
?
看到了吧,使用JPA和NetBeans开发数据层多简单,因为NB向导帮我们生成了大部分代码。在后面的第二部分,我们将看到NB帮我们生成其他层。?
?