mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#668 - ENH: Add ability to register a custom IdGenerator
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package org.example;
|
||||
|
||||
import com.avaje.ebean.config.IdGenerator;
|
||||
import org.avaje.moduuid.ModUUID;
|
||||
|
||||
/**
|
||||
* A customer Id Generator that can be assigned by @GeneratedValue(generator="shortUid")
|
||||
*/
|
||||
public class ModUuidGenerator implements IdGenerator {
|
||||
|
||||
@Override
|
||||
public Object nextValue() {
|
||||
return ModUUID.newShortId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "shortUid";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user