当我尝试将自定义 Expenditure 对象映射到 MySQL 中的关系模型时,出现错误:
Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: javax.money.MonetaryAmount, at table: Expenditure, for columns: [org.hibernate.mapping.Column(monetaryAmount)]
Run Code Online (Sandbox Code Playgroud)
我的支出类别:
@Entity
public class Expenditure implements Comparable<Expenditure> {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String description;
private MonetaryAmount monetaryAmount;
private LocalDate date;
private ExpenditureType type;
@OneToOne
private User client;
...
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下如何进行映射?
我想知道是否可以从Moment对象获取小时,几分钟和几秒钟?
例如:
Moment('12:16','HH:mm').get('minutes') //should result in '16'
Run Code Online (Sandbox Code Playgroud)
我在文档中找不到类似的东西...
当使用 Postman 或从 Angular 前端发出请求时,200 OK即使在错误的路线上,我总是从后端得到空白/空响应。
安全配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/public/**").permitAll()
.anyRequest().authenticated()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
}
Run Code Online (Sandbox Code Playgroud)
例如,检查用户名是否被占用:
@GetMapping("/available")
public Boolean isUsernameTaken(@RequestParam String username) {
return userService.isUsernameTaken(username);
}
Run Code Online (Sandbox Code Playgroud)
甚至没有进入这个方法,但返回的代码是200.
在错误的端点上发出请求http://localhost:8080/fakeEndpoint/xxxxx也会返回空白页和代码 200。
java ×2
java-8 ×1
javascript ×1
jpa ×1
momentjs ×1
node.js ×1
rest ×1
spring ×1
spring-boot ×1