// Path: src/main/java/com/slyak/spring/jpa/util/SnowflakeGenerator.java
// public class SnowflakeGenerator implements IdentifierGenerator {
//     public static final String TYPE = "com.slyak.spring.jpa.util.SnowflakeGenerator";
// 
//     private static final IdWorker idWorker = new IdWorker();
// 
//     @Override
//     public Serializable generate(SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws HibernateException {
//         return idWorker.getId();
//     }
// }


import com.slyak.spring.jpa.util.SnowflakeGenerator;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.domain.Persistable;
import org.springframework.data.jpa.domain.AbstractPersistable;
import org.springframework.util.ClassUtils;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import java.io.Serializable;
package com.slyak.spring.jpa.auditing;



/**
 * .
 *
 * @author stormning on 16/6/13.
 */
@MappedSuperclass
public abstract class BaseEntity<PK extends Serializable> implements Persistable<PK> {

    @Id
// Path: src/main/java/com/slyak/spring/jpa/util/SnowflakeGenerator.java
// public class SnowflakeGenerator implements IdentifierGenerator {
//     public static final String TYPE = "com.slyak.spring.jpa.util.SnowflakeGenerator";
// 
//     private static final IdWorker idWorker = new IdWorker();
// 
//     @Override
//     public Serializable generate(SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws HibernateException {
//         return idWorker.getId();
//     }
// }


// Path: src/main/java/com/slyak/spring/jpa/auditing/BaseEntity.java
import com.slyak.spring.jpa.util.SnowflakeGenerator;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.domain.Persistable;
import org.springframework.data.jpa.domain.AbstractPersistable;
import org.springframework.util.ClassUtils;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import java.io.Serializable;

package com.slyak.spring.jpa.auditing;



/**
 * .
 *
 * @author stormning on 16/6/13.
 */
@MappedSuperclass
public abstract class BaseEntity<PK extends Serializable> implements Persistable<PK> {

    @Id
    @GenericGenerator(name="snowflake",strategy = SnowflakeGenerator.TYPE)