My entity bean named Stock contain
@OneToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
@JoinColumn(name="stockid")
private List<StockSize> stockSizeList = new ArrayList<StockSize>();
My StockSize entity bean contain one field stockid from Stock
Below is the code to set Stock entity value
Stock stock = new Stock();
stock.setDesignCode("123design");
stock.setLotNo("123lot");
stock.setCreatedByUserId(getIBusinessDelegateOperationSessionContext().getUserId());
stock.setCreatedDate(new Date());
stock.setIsSystemRecord(StaticTableConstants.NOT_ISSYSTEMRECORD);
stock.setLastModifiedDate(new Date());
stock.setLastModifiedByUserId(getIBusinessDelegateOperationSessionContext().getUserId());
stock.setStockSizeList(listStockSize != null ? listStockSize : new ArrayList<StockSize>());
Its gives an error as it can't get stockid when container persist StockSize
So is there any post-persist type of thing in EJB3.0 i.e StockSize persist after persisting stock ?
or only one solution that i have to persist both entity separate.