@@ -0,0 +1,1633 @@
+package to.etc.domui.hibernate.idgen;%0A%0Aimport org.hibernate.HibernateException;%0Aimport org.hibernate.engine.SessionImplementor;%0Aimport org.hibernate.id.IdentifierGenerator;%0Aimport to.etc.util.StringTool;%0A%0Aimport java.io.Serializable;%0Aimport java.util.UUID;%0A%0A/**%0A * Create a String identifier that is based on an UUID, but which does%0A * not use the very verbose string format of those things. Instead the%0A * 128 bits are rendered as a base64 string (with the last 2 == signs%0A * stripped), forming a 23 char identifier.%0A *%0A * To use the generator annotate your class(es) ID property as follows:%0A * %3Cpre%3E%0A *  &#064;GeneratedValue(generator = %22uuid3%22)%0A * %09&#064;GenericGenerator(name = %22uuid3%22, strategy = %22to.etc.domui.hibernate.idgen.UUIDGenerator23%22)%0A * %09&#064;Id%0A * %09&#064;Column(name = %22id%22, length = 23, nullable = false)%0A * %09&#064;Nullable @Override public String getId() %7B%0A * %09%09return m_id;%0A *  %7D%0A * %3C/pre%3E%0A *%0A * @author %3Ca href=%22mailto:jal@etc.to%22%3EFrits Jalvingh%3C/a%3E%0A * Created on 12-2-18.%0A */%0Afinal public class UUIDGenerator23 implements IdentifierGenerator %7B%0A%09@Override public Serializable generate(SessionImplementor sessionImplementor, Object o) throws HibernateException %7B%0A%09%09UUID uuid = UUID.randomUUID();%0A%09%09byte%5B%5D data = new byte%5B16%5D;%0A%0A%09%09moveBytes(data, 0, uuid.getMostSignificantBits());%0A%09%09moveBytes(data, 8, uuid.getLeastSignificantBits());%0A%09%09String str = StringTool.encodeBase64ToString(data);%0A%0A%09%09return str.substring(0, 23);%09%09%09%09// Strip the ==%0A%09%7D%0A%0A%09private void moveBytes(byte%5B%5D bytes, int offset, long bits) %7B%0A%09%09for(int i = 8; --i %3E= 0;) %7B%0A%09%09%09bytes%5Bi + offset%5D = (byte) (bits & 0xff);%0A%09%09%09bits = bits %3E%3E 8;%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Add generic UUID ID generator for Hibernate that does not use that many characters.