英文:
Error running Junit test with DBUNIT on SpringBoot project
问题
我有一个 Junit 测试,在运行时出现以下错误:
org.dbunit.dataset.NoSuchColumnException: AUTORISATION_BONANZA.ORGANISATION_ID - (非大写输入列:ORGANISATION_ID)在 ColumnNameToIndexes 缓存映射中。请注意,映射的列名不区分大小写。
实体类:
@Entity
@NoArgsConstructor
@Data
public class AutorisationBonanza implements Serializable {
@Id
@Column(name = "AUTORISATION_BONANZA_ID")
private Long autorisationBonanzaId;
private String pol;
private String nomom;
@ManyToOne
@JoinColumn(name = "ORGANISATION_ID")
private Organisation organisation;
}
数据集:
<AUTORISATION_BONANZA
AUTORISATION_BONANZA_ID="1"
POL="NOM"
NOMOM="PRENOM"
ORGANISATION_ID="1"
/>
以及:
@Entity
@NoArgsConstructor
@Data
public class Organisation implements Serializable {
@Id
@Column(name = "ORGANISATION_ID")
private Long organisationId;
private String code;
}
英文:
I have a Junit test, that when I run it I have this error:
org.dbunit.dataset.NoSuchColumnException: AUTORISATION_BONANZA.ORGANISATION_ID - (Non-uppercase input column: ORGANISATION_ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
the entity
@Entity
@NoArgsConstructor
@Data
public class AutorisationBonanza implements Serializable {
@Id
@Column(name = "AUTORISATION_BONANZA_ID")
private Long autorisationBonanzaId;
private String pol;
private String nomom;
@ManyToOne
@JoinColumn(name = "ORGANISATION_ID")
private Organisation organisation;
}
the dataset:
<AUTORISATION_BONANZA
AUTORISATION_BONANZA_ID="1"
POL="NOM"
NOMOM="PRENOM"
ORGANISATION_ID="1"
/>
and
@Entity
@NoArgsConstructor
@Data
public class Organisation implements Serializable {
@Id
@Column(name = "ORGANISATION_ID")
private Long organisationId;
private String code;
}
答案1
得分: 1
尝试将以下内容添加到属性文件中:
org.dbunit.database.IMetadataHandler.implClassName=org.dbunit.ext.mysql.MySqlMetadataHandler
英文:
try to add this on the property file:
org.dbunit.database.IMetadataHandler.implClassName=org.dbunit.ext.mysql.MySqlMetadataHandler
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论