/* * __NAME__.java * * Created on __DATE__, __TIME__ * * This is a persistent entity class which is a simple JavaBean class with some properties. * You can see that this class uses standard JavaBean naming conventions for property getter and setter methods, as well as private visibility for the fields. * This is a recommended design - but not required. Hibernate can also access fields directly, the benefit of accessor methods is robustness for refactoring. * The id property holds a unique identifier value for a particular event. All persistent entity classes (there are less important dependent classes as well) * will need such an identifier property if we want to use the full feature set of Hibernate. In fact, most applications (esp. web applications) need to * distinguish objects by identifier, so you should consider this a feature rather than a limitation. However, we usually don't manipulate the identity of an * object, hence the setter method should be private. Only Hibernate will assign identifiers when an object is saved. You can see that Hibernate can access * public, private, and protected accessor methods, as well as (public, private, protected) fields directly. The choice is up to you and you can match it to * fit your application design. * * The no-argument constructor is a requirement for all persistent classes; Hibernate has to create objects for you, using Java Reflection. * The constructor can be private, however, package visibility is required for runtime proxy generation and efficient data retrieval without bytecode instrumentation. * */ package hibernateapp.hbvo; /** * * @author karan */ public class __NAME__ { private Long id; public __NAME__() {} public Long getId() { return id; } private void setId(Long id) { this.id = id; } }