Model.java:
import lombok.Data;
@Entity
@Table(name = "CUSTOMER")
@Data
public class Model{
@Id
@Column(name = "UNIQ_ID")
private String uniqId;
@Column(name = "CUSTOMER_ID",insertable = false,updatable=false)
private String customerId;
@Column(name = "STATUS")
private String status;
@ManyToOne
@JoinColumn(name = "CUSTOMER_ID")
private Customer model;
}
ModelRepository.java
public interface ModelRepository extends JpaRepository<Model,
String>,JpaSpecificationExecutor<Model> {
}
ModelService.java
@Inject
private ModelRepository modelRepo;
@Transactional
public void registerCustomermodel(Model modeldata) {
modelRepo.save(modeldata);
}
public static void main(String[] args)
{
ModelService cs=new ModelService();
Model model=new Model();
model.setCustomerId("111000000373");
model.setUniqId("117");
model.setStatus("null");
cs.registerCustomermodel(model);
}
我的所有数据源配置文件都很好,同时执行此im获取空指针异常。谁能解释一下可能的原因是什么?