jSQL-Gen icon indicating copy to clipboard operation
jSQL-Gen copied to clipboard

Reusable enums / Inter-table enums

Open Osiris-Team opened this issue 2 years ago • 0 comments

To prevent ugly stuff like this:

            Review.Rating rating = values[i];
            List<ReviewRating> reviewRatings = ReviewRating.whereReviewId().is(review.id)
                    .and(ReviewRating.whereRating().is(ReviewRating.Rating.valueOf(rating.name()))).get();

Instead, it could look like this if the enum was imported instead of redefined in the other table:

            Review.Rating rating = values[i];
            List<ReviewRating> reviewRatings = ReviewRating.whereReviewId().is(review.id)
                    .and(ReviewRating.whereRating().is(rating).get();

Details: We have a enum named Rating defined twice in the Review table and the ReviewRating table even though its exactly the same enum used.

Osiris-Team avatar Nov 29 '23 15:11 Osiris-Team