ssh用的sqlserver设了主键自增长,怎么执行插入的时候还会 Hibernate: select hibernate_sequence.nextval

2025-01-07 02:55:33
推荐回答(1个)
回答1:

@Bean(name="sessionFactory")
public AnnotationSessionFactoryBean getsessionfactory(){
AnnotationSessionFactoryBean asf=new AnnotationSessionFactoryBean();
asf.setDataSource(this.getdatasource());
Properties pr=new Properties();
pr.put("hibernate.dialect", org.hibernate.dialect.OracleDialect.class);这里就是设置方言的
pr.put("hibernate.show_sql", "true");
//pr.put("hibernate.hbm2ddl.auto", "create");
asf.setHibernateProperties(pr);