【发布时间】:2021-09-06 05:33:40
【问题描述】:
在实体类中,我有一个字段为:@Column(name = "alias", length = 255) private List<String> akaList;
运行时出现错误:
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.List, at table: customer, for columns: [org.hibernate.mapping.Column(alias)]
可能是什么原因?
【问题讨论】:
-
这是一个原始类型。因此,hibernate 无法计算出您想要的列表中的内容。添加类型。
-
什么意思?)你能举个例子吗?
-
我想将此列表 保存到数据库中。像这样:repository.saveAll()
-
您的
akaList持有哪些对象?字符串,还是别的什么?
标签: java xml spring hibernate jpa