cockroachdb / cockroachdb/examples-orms

Some issues with the Hibernate example

Open
#94 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
82
Forks
37
PR merge metrics
No merged PRs in 30d

Description

I'm currently translating some of the Java/Hibernate examples to jOOQ and found a few issues that you may or may not want to address:

### `CustomerService::deleteCustomer` fails when orders have `OrderProduct` entries:

This query here:

https://github.com/cockroachdb/examples-orms/blob/8aacfca23a8b91667aad846e7e41e4e14c7658cc/java/hibernate/src/main/java/com/cockroachlabs/services/CustomerService.java#L83

Will fail in case there are entries in `order_products`, which does not have `ON DELETE CASCADE` clauses on its foreign keys by default (I think). I'm not sure if this is desired here.

### `OrderService::deleteOrder` fails because of wrong query:

This query here:

https://github.com/cockroachdb/examples-orms/blob/8aacfca23a8b91667aad846e7e41e4e14c7658cc/java/hibernate/src/main/java/com/cockroachlabs/services/OrderService.java#L83

Will fail because the `Order` entity doesn't have an `order_id` column. I think the intention here was to delete the record in `order_products`

Contributor guide

No contributing guide indexed for this repository

Research direction

Read java/hibernate/src/main/java/com/cockroachlabs/services/CustomerService.java around line 83 and OrderService.java around line 83. Check how each deletion behaves when order_products entries exist, then verify that customer and order deletion no longer fails and that the intended order_products record is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, database
Issue type
Bug
Difficulty
2/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.