mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1842 - Refactor persisting to delay the setting of generated Id value (sequences and deferred imported ids)
This commit is contained in:
@@ -3107,6 +3107,18 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
|
||||
return idType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the generated Id value if appropriate.
|
||||
*/
|
||||
public void setGeneratedId(EntityBean entityBean, Transaction transaction) {
|
||||
if (idGenerator == null || idProperty == null || idProperty.isEmbedded()) {
|
||||
return;
|
||||
}
|
||||
if (isNullOrZero(idProperty.getValue(entityBean))) {
|
||||
convertSetId(nextId(transaction), entityBean);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the Id value is marked as a <code>@GeneratedValue</code>.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user