我正在使用这个gegnerator
public class StringIdGenerator implements IdentifierGenerator {
final public static String NAME=StringIdGenerator.class.getSimpleName();
public Serializable generate(SessionImplementor session, Object object) throws HibernateException {
return UUID.randomUUID().toString().replace("-","");
}
}
@Entity
@GenericGenerator(name = "pt_sequence", strategy = "dao.StringIdGenerator")
public class P {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY,generator = "pt_sequence")
String id;
.......
为什么在插入后我看到插入了2个元素,而不是一个?