hibernate中使用Class.simpleName获取实体名

举例;

package com.te
public class Student{};

 使用

SessionFactory sf = null;
//
String className = ((org.hibernate.impl.SessionFactoryImpl)sf).getImportedClassName("Student");
Assert.assertEquals(className,"com.te.Student");

猜你喜欢

转载自fly-down.iteye.com/blog/1894779