/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.pieshare.database; import javax.persistence.Entity; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity //@Table(name = "testUser") // @Table is optional, but "user" is a keyword in many SQL variants public class TestUserEntity { @Id // @Id indicates that this it a unique primary key @GeneratedValue // @GeneratedValue indicates that value is automatically generated by the server private Long id; @Column(length = 32, unique = true) // the optional @Column allows us makes sure that the name is limited to a suitable size and is unique private String name; // note that no setter for ID is provided, Hibernate will generate the ID for us public long getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } }