java - google cloud java app的测试版和部署版效果不同
问题描述
我有一个 Spring Boot 应用程序部署到我的谷歌云。
我的项目中有这个代码......
public void deleteBuyers(Account account, Buyer... buyers) {
for (Buyer b : buyers) {
account.getBuyers().remove(b);
}
repository.save(account);
}
在帐户中,我有一个买家列表...我需要从帐户中更改买家..所以我从帐户中删除买家,然后在买家上设置新帐户。
但是当我去帐户时。我在旧帐户和新帐户上都设置了买方。
这可能是什么?
上面调用的代码
@Transactional
public void update(Long id, Buyer updatedBuyer) {
Buyer buyer = find(id);
Buyer found = repository.findByEmailAndAccount(updatedBuyer.getEmail(), updatedBuyer.getAccount()).orElse(null);
if (found != null && !found.getId().equals(id)) {
throw new DataIntegrityException("Comprador já cadastrado");
}
accountService.deleteBuyers(buyer.getAccount(), buyer);
buyer.setEmail(updatedBuyer.getEmail());
buyer.setTelephone(updatedBuyer.getTelephone());
buyer.setCreationDate(updatedBuyer.getCreationDate());
buyer.setExpirationDate(updatedBuyer.getExpirationDate());
buyer.setAccount(updatedBuyer.getAccount());
buyer.getAccount().addBuyer(buyer);
repository.save(buyer);
}
在本地测试时,它可以工作..买方仅在最后设置的帐户上。但是当我上传 jar 时,买家在两个帐户上都设置了
编辑:使用我的 project1 不起作用(datastore southamerica-1) 使用我的 project 2 正在工作(datastore nam5 us-central) 也许数据库位置有错误?
解决方案
推荐阅读
- c - C / x64 ASM 中的实用定界延续
- c# - Unity中的弹性对象?
- join - 子查询连接
- r - R quantstrat:尽管有所有信号,但没有完成交易
- php - 如何使php中的html表格内部回显正常比赛
- php - if语句在where子句mysql语法错误
- kotlin - RxKotlin repo gradle build compilation fails with gradle 4.7 (JDK 1.8)
- vba - VBA ByRef argument type mismatch of 'i' within a For Loop
- python - Pygame 鼠标点击和矩形交点
- c++ - Multiplication is returning me incorrect values