#How to set UUID as a primary key, and make an entry?
9 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @leaden hedge! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
So if I tried to do this (without setting UUID manually)
@Override
public Mono<RestaurantGroup> createRestaurantGroup(String userId, RestaurantGroupCreateDTO restaurantGroupCreateDTO) {
RestaurantGroup restaurantGroup = RestaurantGroupMapper.restaurantGroupCreateDTOToRestaurantGroup(restaurantGroupCreateDTO);
// UUID uuid = UUID.randomUUID();
// restaurantGroup.setId(uuid);
return restaurantGroupRepository.save(restaurantGroup);
}
It throws error as
null value in column \"id\" of relation \"restaurant_group\" violates not-null constraint"
If I tried to set manually (by uncommenting the lines)
Failed to update table [restaurant_group]; Row with Id [d3d8d8dd-305f-4cda-9e69-0d764d66837b] does not exist",
I use webflux
ok I found the solution