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);
}
All my data source configuration files are well figured, while executing this im getting null pointer exception. Can anyone explain what are the possible reasons?