我正在内存数据库中插入数据,在插入数据时我遇到了问题,
使用 boot、JPA、H2db 在 inMemory 中插入数据的示例程序
创建Pojo并使用JPA注释进行注释
创建用于查询的 data.sql 文件。
运行应用程序。请在屏幕截图中查找问题详细信息。
我尝试了多种方法,但仍然出现同样的异常
在app.prop中配置:String url = jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE
在 data.sql 文件中添加@Table
给定表
添加了@Column
data.sql 中提到的转换名称。
在哪里配置;DB_CLOSE_ON_EXIT=FALSE
在 springboot 中?
波乔
@Entity
@Table(name = "exchange_value")
public class CurrencyExchange {
@Id
private Long id;
@Column(name = "currency_from")
private String from;
@Column(name = "currency_to")
private String to;
@Column(name = "conversion_multiple")
private BigDecimal conversion;
private int port;
Run Code Online (Sandbox Code Playgroud)
控制器
@Autowired
private Environment env;
@GetMapping("/currency-exchange/from/{from}/to/{to}")
public CurrencyExchange retriveCurrencyExchange(@PathVariable String from,@PathVariable String to)
{
CurrencyExchange …
Run Code Online (Sandbox Code Playgroud)