我有超过1000个用于创建和插入数据的存储库,
headerDetailLinkn00001.java
@Entity // This tells Hibernate to make a table out of this class
@Table(name="HDL_HEADER_DETAIL_LINK_00001")
public class HeaderDetailLink00001{
@Id
@Column(name="HDL_ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name="DRI_ID")
private Integer driId;
@Column(name="CSD_ID")
private Integer csdId;
...getter and setter
}
HeaderDetailLink00001Repository.java
public interface HeaderDetailLink00001Repository extends JpaRepository<HeaderDetailLink00001,Long>{
List<HeaderDetailLink00001> findTopByOrderByIdDesc();
}
controller.java
@GetMapping(path = "updateHeaderDetailTable")
public @ResponseBody int updateHeaderDetailTable(@RequestParam(value = "catNum", required = true) Integer catNum)
{
List<DailyHeaderResult> listBySymcatNum = DailyHeaderResultRepository.findBycatNum(catNum);
List<HeaderDetailLink00001> chdlList = new ArrayList<HeaderDetailLink00001>();
HeaderDetailLink00001 lastRecordOflinkTableId = HeaderDetailLink00001Repository.findTopByOrderByIdDesc().get(0);
this.setPreviousIndex(lastRecordOflinkTableId.getCsdId());
logger.info("sxxxxxxxxxxxxxId==="+lastRecordOflinkTableId.getCsdId()+" "+lastRecordOflinkTableId.getDriId());
...
我要创建HeaderDetailLink00001,HeaderDetailLink00002 ... HeaderDetailLink10000 ...等。 是否有可能使HeaderDetailLink00001和List动态生成。