添加bootstrap后台模板

master
10295 7 years ago
parent 51e82d7d90
commit b52b93db5a
  1. 20
      web/src/test/java/SpringTest.java

@ -13,12 +13,12 @@ import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projections;
import org.hibernate.metamodel.internal.MetamodelImpl;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.schema.TargetType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.BeanUtils;
import org.springframework.dao.DataAccessException;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
@ -26,7 +26,6 @@ import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import web.config.AppConfig;
import web.config.SpringConfig;
import javax.annotation.Resource;
import java.io.File;
@ -48,6 +47,10 @@ public class SpringTest {
@Resource
private BaseDao2 baseDao2;
@Test
public void factory(){
MetamodelImpl metamodel= (MetamodelImpl) baseDao1.getSessionFactory().getMetamodel();
}
@Test
@Transactional("transactionManager2")
@ -141,4 +144,17 @@ public class SpringTest {
e.printStackTrace();
}
}
@Test
public void test4() throws IOException {
DetachedCriteria criteria=DetachedCriteria.forClass(DataModel.class);
List<DataModel> dataEntities= (List<DataModel>) baseDao1.findByCriteria(criteria,10,10);
for(DataModel dataEntity:dataEntities){
log.info(dataEntity.getCid());
}
// 查询总条数
Long count=baseDao1.executeWithNativeSession((Session session)-> (Long) DetachedCriteria.forClass(DataModel.class).setProjection(Projections.rowCount()).setProjection(Projections.groupProperty("groupId")).getExecutableCriteria(session).uniqueResult());
}
}

Loading…
Cancel
Save