@@ -33,6 +33,8 @@ protected static List<String> createStatements() {
3333 return ImmutableList .of (
3434 "CREATE TYPE dimensions(length int, width int, height int)" ,
3535 "CREATE TABLE product(id uuid PRIMARY KEY, description text, dimensions dimensions)" ,
36+ "CREATE TABLE productwithoutid(id uuid, clustering int, description text, PRIMARY KEY((id), clustering))" ,
37+ "CREATE TABLE only_pk(id uuid PRIMARY KEY)" ,
3638 "CREATE CUSTOM INDEX product_description ON product(description) "
3739 + "USING 'org.apache.cassandra.index.sasi.SASIIndex' "
3840 + "WITH OPTIONS = {"
@@ -118,6 +120,43 @@ public String toString() {
118120 }
119121 }
120122
123+ @ Entity
124+ public static class ProductWithoutId {
125+ private String description ;
126+
127+ public ProductWithoutId () {}
128+
129+ public ProductWithoutId (String description ) {
130+ this .description = description ;
131+ }
132+
133+ public String getDescription () {
134+ return description ;
135+ }
136+
137+ public void setDescription (String description ) {
138+ this .description = description ;
139+ }
140+
141+ @ Override
142+ public boolean equals (Object o ) {
143+ if (this == o ) return true ;
144+ if (o == null || getClass () != o .getClass ()) return false ;
145+ ProductWithoutId that = (ProductWithoutId ) o ;
146+ return Objects .equals (description , that .description );
147+ }
148+
149+ @ Override
150+ public int hashCode () {
151+ return Objects .hash (description );
152+ }
153+
154+ @ Override
155+ public String toString () {
156+ return "ProductWithoutId{" + "description='" + description + '\'' + '}' ;
157+ }
158+ }
159+
121160 @ Entity
122161 public static class Dimensions {
123162
@@ -179,4 +218,41 @@ public String toString() {
179218 return "Dimensions{" + "length=" + length + ", width=" + width + ", height=" + height + '}' ;
180219 }
181220 }
221+
222+ @ Entity
223+ public static class OnlyPK {
224+ @ PartitionKey private UUID id ;
225+
226+ public OnlyPK () {}
227+
228+ public OnlyPK (UUID id ) {
229+ this .id = id ;
230+ }
231+
232+ public UUID getId () {
233+ return id ;
234+ }
235+
236+ public void setId (UUID id ) {
237+ this .id = id ;
238+ }
239+
240+ @ Override
241+ public boolean equals (Object o ) {
242+ if (this == o ) return true ;
243+ if (o == null || getClass () != o .getClass ()) return false ;
244+ OnlyPK onlyPK = (OnlyPK ) o ;
245+ return Objects .equals (id , onlyPK .id );
246+ }
247+
248+ @ Override
249+ public int hashCode () {
250+ return Objects .hash (id );
251+ }
252+
253+ @ Override
254+ public String toString () {
255+ return "OnlyPK{" + "id=" + id + '}' ;
256+ }
257+ }
182258}
0 commit comments