Document:Domein model en POJOs

From WOSI
Jump to: navigation, search

Aanwijzingen voor het schrijven van een POJO

@Entity
public class Entity implements WOSIEntity {
 
	private Long id;
	private String name;
 
	@Id
	@GeneratedValue(strategy = IDENTITY)
	public Long getId() { return this.id; }
	public Entity setId(Long id) { this.id = id; return this; };
 
	@Column(length=50, nullable=false)
	public String getName() { return this.name; }
	public Entity setName(String name) { this.name = name; return this; }
 
	/**
	 * Returns the string representation of this Entity. Currently
	 * it returns the same value as Entity.getName().
	 */
	@Override
	public String toString() {
		return this.getName();
	}
}
Personal tools