File tree Expand file tree Collapse file tree
spring-boot/cache/src/main/java/io/reflectoring/cache/dao Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package io .reflectoring .cache .dao ;
22
3+ import com .hazelcast .nio .ObjectDataInput ;
4+ import com .hazelcast .nio .ObjectDataOutput ;
5+ import com .hazelcast .nio .serialization .DataSerializable ;
36import lombok .AllArgsConstructor ;
47import lombok .Builder ;
58import lombok .Data ;
912import javax .persistence .GeneratedValue ;
1013import javax .persistence .GenerationType ;
1114import javax .persistence .Id ;
12- import java .io .Serializable ;
15+ import java .io .IOException ;
1316import java .util .UUID ;
1417
1518@ Entity
1619@ Data
1720@ NoArgsConstructor
1821@ AllArgsConstructor
1922@ Builder
20- public class Car implements Serializable {
23+ public class Car implements DataSerializable {
2124
2225 @ Id
2326 @ GeneratedValue (strategy = GenerationType .AUTO )
2427 private UUID id ;
2528 private String name ;
2629 private String color ;
30+
31+ @ Override
32+ public void writeData (ObjectDataOutput out ) throws IOException {
33+ out .writeUTF (id .toString ());
34+ out .writeUTF (name );
35+ out .writeUTF (color );
36+ }
37+
38+ @ Override
39+ public void readData (ObjectDataInput in ) throws IOException {
40+ id = UUID .fromString (in .readUTF ());
41+ name = in .readUTF ();
42+ color = in .readUTF ();
43+ }
2744}
You can’t perform that action at this time.
0 commit comments