Package org.makersoft.shards.id

Examples of org.makersoft.shards.id.IdGenerator.generate()


    SqlSession session = shardIdsToShards.get(shardId).establishSqlSession();

    IdGenerator idGenerator = shardedSqlSessionFactory.getIdGenerator();
    if (idGenerator != null) {
      //TODO(fengkuok) 生成主键 DB生成主键是用专有session?
      Serializable id = idGenerator.generate(session, parameter);

      log.debug(String
          .format("Generating id for object %s ,the type of IdGenerator is %s and generated Id is %s.",
              parameter.getClass(), idGenerator.getClass(), id));
View Full Code Here


    IdGenerator gen2 = new ShardedUUIDGenerator();

    for (int i = 0; i < Integer.MAX_VALUE; i++) {
      String id = (String) gen.generate(null, null);
      System.out.println(id);
      String id2 = (String) gen2.generate(null, null);
      System.out.println(id2);
    }

  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.