我正在尝试使用Arquillian测试我的应用程序。这是域类:
@Data
@RequiredArgsConstructor
@AllArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Entity
@Table(name = "flights")
public class Flight extends BaseEntity<Long> {
private LocalDateTime arrivalTime;
private LocalDateTime departureTime;
private String departureAirport;
private String arrivalAirport;
@Enumerated
private FlightCompany flightCompany;
}
正常部署时哪个会正确创建带有LocalDateTime作为时间戳的表,但是当我使用Arquillian部署时:
@Deployment(testable = true)
public static WebArchive createDeployment() {
File[] files = Maven.resolver().resolve("org.hibernate:hibernate-core:5.1.0.Final").withTransitivity().asFile();
return ShrinkWrap.create(WebArchive.class, "test.war").addClasses(FlightController.class, RestApplication.class)
.addPackage(IService.class.getPackage()).addPackage(BaseConverter.class.getPackage())
.addClass(FlightManager.class).addPackage(Flight.class.getPackage())
.addClass(LocalDateTimeConverter.class).addPackage(BaseDto.class.getPackage())
.addClass(CORSFilter.class).addAsResource("hibernate.cfg.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsLibraries(files)
.addAsLibrary("postgresql-42.2.4.jar");
}
LocalDateTime保存为字节数组(我使用的是相同的休眠cfg文件)。此外,当我从常规部署中创建数据库并运行测试进行验证时,它会丢失列异常。为什么?>