@@ -63,8 +63,8 @@ public JdbcWalletRepository(DataSource dataSource) {
6363 @ Override
6464 public Wallet insert (Wallet wallet ) {
6565 var update = jdbcTemplate .update ("INSERT INTO wallet(wallet_id, customer_id) VALUES (UUID_TO_BIN(?), UUID_TO_BIN(?))" ,
66- wallet .getWalletId (),
67- wallet .getCustomerId ());
66+ wallet .getWalletId (). toString () ,
67+ wallet .getCustomerId (). toString () );
6868 if (update != 1 ) {
6969 throw new RuntimeException ("Nothing was inserted" );
7070 }
@@ -76,7 +76,7 @@ public Optional<Wallet> findById(UUID walletId) {
7676 try {
7777 return Optional .ofNullable (jdbcTemplate .queryForObject ("select * from wallet WHERE wallet_id = UUID_TO_BIN(?)" ,
7878 walletRowMapper ,
79- walletId .toString (). getBytes () ));
79+ walletId .toString ()));
8080 } catch (EmptyResultDataAccessException e ) {
8181 logger .error ("Got empty result" , e );
8282 return Optional .empty ();
@@ -99,8 +99,8 @@ public List<Voucher> findVouchersByCustomerId(UUID customerId) {
9999 @ Override
100100 public void deleteVoucherByVoucherId (UUID customerId , UUID voucherId ) {
101101 var update = jdbcTemplate .update ("DELETE from wallet_customer_voucher WHERE customer_id = UUID_TO_BIN(?) and voucher_id = UUID_TO_BIN(?)" ,
102- customerId .toString (). getBytes () ,
103- voucherId .toString (). getBytes () );
102+ customerId .toString (),
103+ voucherId .toString ());
104104 if (update != 1 ) {
105105 throw new RuntimeException ("Nothing was deleted" );
106106 }
@@ -111,7 +111,7 @@ public Optional<Customer> findCustomerByVoucherId(UUID voucherId) {
111111 return Optional .ofNullable (jdbcTemplate .queryForObject ("select c.customer_id, c.name, c.is_black from customers c inner join wallet_customer_voucher inter" +
112112 "on c.customer_id = inter.customer_id where inter.voucher_id = UUID_TO_BIN(?)" ,
113113 customerRowMapper ,
114- voucherId .toString (). getBytes () ));
114+ voucherId .toString ()));
115115 }
116116
117117 @ Override
@@ -123,9 +123,9 @@ public void deleteById(UUID walletId) {
123123 @ Override
124124 public void addVoucherByCustomerId (UUID walletId , UUID customerId , UUID voucherId ) {
125125 var update = jdbcTemplate .update ("INSERT INTO wallet_customer_voucher(wallet_id, customer_id, voucher_id) VALUES (UUID_TO_BIN(?), UUID_TO_BIN(?), UUID_TO_BIN(?))" ,
126- walletId .toString (). getBytes () ,
127- customerId .toString (). getBytes () ,
128- voucherId .toString (). getBytes () );
126+ walletId .toString (),
127+ customerId .toString (),
128+ voucherId .toString ());
129129 if (update != 1 ) {
130130 throw new RuntimeException ("Nothing was inserted" );
131131 }
0 commit comments