File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
batch/chunk-csv-database/src/main
java/org/javaee7/batch/chunk/csv/database Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 4343import javax .persistence .Basic ;
4444import javax .persistence .Column ;
4545import javax .persistence .Entity ;
46+ import javax .persistence .GeneratedValue ;
47+ import javax .persistence .GenerationType ;
4648import javax .persistence .Id ;
4749import javax .persistence .NamedQueries ;
4850import javax .persistence .NamedQuery ;
6264 @ NamedQuery (name = "Person.findByName" , query = "SELECT c FROM Person c WHERE c.name = :name" ),
6365 @ NamedQuery (name = "Person.findByHiredate" , query = "SELECT c FROM Person c WHERE c.hiredate = :hiredate" )})
6466public class Person implements Serializable {
65- private static final long serialVersionUID = 1L ;
67+
6668 @ Id
69+ @ GeneratedValue (strategy = GenerationType .AUTO )
70+ private int id ;
71+
72+ private static final long serialVersionUID = 1L ;
6773 @ Basic (optional = false )
6874 @ NotNull
6975 @ Size (min = 1 , max = 50 )
7076 @ Column (name = "NAME" )
7177 private String name ;
72-
78+
7379 @ Basic (optional = false )
7480 @ NotNull
7581 @ Size (min = 1 , max = 50 )
@@ -88,6 +94,14 @@ public Person(String name, String hiredate) {
8894 this .hiredate = hiredate ;
8995 }
9096
97+ public int getId () {
98+ return id ;
99+ }
100+
101+ public void setId (int id ) {
102+ this .id = id ;
103+ }
104+
91105 public String getName () {
92106 return name ;
93107 }
@@ -128,5 +142,5 @@ public boolean equals(Object object) {
128142 public String toString () {
129143 return name ;
130144 }
131-
145+
132146}
Original file line number Diff line number Diff line change 1- CREATE TABLE CHUNK_CSV_DATABASE (" NAME" VARCHAR (50 ) not null primary key , " HIREDATE" VARCHAR (50 ) not null )
1+ CREATE TABLE CHUNK_CSV_DATABASE (" ID " INTEGER not null primary key , " NAME" VARCHAR (50 ) not null primary key , " HIREDATE" VARCHAR (50 ) not null )
You can’t perform that action at this time.
0 commit comments