Spring数据mongodb没有找到java.lang.String错误的映射元数据

时间:2013-12-25 17:43:28

标签: spring mongodb

我正在尝试使用spring data mongodb从数据库中检索集合列表。但是,只要我的代码运行,我就会得到以下异常:

  

org.springframework.data.mapping.model.MappingException:找不到java.lang.String的映射元数据       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:209)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1008)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.access $ 100(MappingMongoConverter.java:75)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter $ MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:957)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter $ MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:924)       在org.springframework.data.mapping.model.PersistentEntityParameterValueProvider.getParameterValue(PersistentEntityParameterValueProvider.java:78)       在org.springframework.data.mapping.model.SpELExpressionParameterValueProvider.getParameterValue(SpELExpressionParameterValueProvider.java:63)       在org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:70)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:232)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:212)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:176)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:172)       在org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:75)

我无法在任何地方找到解决方案。任何帮助都将受到高度赞赏

这是我的java代码,用于检索数据:

public List<GateAppointment> listGateAppointments() {
    List<GateAppointment> gateAppointments = null;
    try{
        MongoOperations mongoOperation = (MongoOperations)getMongoTemplate();
        gateAppointments = mongoOperation.findAll(GateAppointment.class,COLLECTION_NAME);
    }
    catch(Exception e){
        e.printStackTrace();
    }
    return gateAppointments;
}

public static final String COLLECTION_NAME = "gateVisitAppointments";

以下是我的数据库数据样本(对不起,因为我没有10个代表而直接发布图片):

Please click to view DB Image

以下是我的GateAppointment类文件属性(文件的其余部分包含所有setter和getter):

package com.ig.avs.common.entity.db;

public class GateAppointment {

/**
 * The Class GateAppointment.
 * 
 */
private String gate;
private String gateAppointmentNbr;
private String bol;
private String containerNbr;
private String iso;
private String line;
private String transactionType;
private String truckingCompany;
private String truckId;
private String appoinmentDate;
private String apSlot;
private String slotStartTime;
private String slotEndTime;
private String isMapped;
private String status;

0 个答案:

没有答案