/** * return the next unique identity value. * <p> * Uses the BeanDescriptor deployment information to determine the sequence to * use. * </p> */ @Override public Object nextId(Class<?> beanType) { BeanDescriptor<?> desc = getBeanDescriptor(beanType); return desc.nextId(null); }
/** * Set Id Generated value for insert. */ private void setIdGenValue(PersistRequestBean<?> request) { BeanDescriptor<?> desc = request.getBeanDescriptor(); if (!desc.isUseIdGenerator()) { return; } BeanProperty idProp = desc.getIdProperty(); if (idProp == null || idProp.isEmbedded()) { // not supporting IdGeneration for concatenated or Embedded return; } EntityBean bean = request.getEntityBean(); Object uid = idProp.getValue(bean); if (DmlUtil.isNullOrZero(uid)) { // generate the nextId and set it to the property Object nextId = desc.nextId(request.getTransaction()); // cast the data type if required and set it desc.convertSetId(nextId, bean); } }
/** * return the next unique identity value. * <p> * Uses the BeanDescriptor deployment information to determine the sequence to * use. * </p> */ @Override public Object nextId(Class<?> beanType) { BeanDescriptor<?> desc = getBeanDescriptor(beanType); return desc.nextId(null); }
/** * Set Id Generated value for insert. */ private void setIdGenValue(PersistRequestBean<?> request) { BeanDescriptor<?> desc = request.getBeanDescriptor(); if (!desc.isUseIdGenerator()) { return; } BeanProperty idProp = desc.getIdProperty(); if (idProp == null || idProp.isEmbedded()) { // not supporting IdGeneration for concatenated or Embedded return; } EntityBean bean = request.getEntityBean(); Object uid = idProp.getValue(bean); if (DmlUtil.isNullOrZero(uid)) { // generate the nextId and set it to the property Object nextId = desc.nextId(request.getTransaction()); // cast the data type if required and set it desc.convertSetId(nextId, bean); } }