如何从maniplate db的hibernate模板中获取dailect对象
谢谢您可以获得以下信息:如何从maniplate db的hibernate模板中获取dailect对象,hibernate,jdbc,database-design,Hibernate,Jdbc,Database Design,谢谢您可以获得以下信息: String driverName = this.getSession().connection().getMetaData().getDriverName(); if (driverName.contains(Const.DATABASE_SQLSERVER)) { ps = this.getSession().connection() .prepareStatement("select next value for " + seqNa
String driverName = this.getSession().connection().getMetaData().getDriverName();
if (driverName.contains(Const.DATABASE_SQLSERVER)) {
ps = this.getSession().connection()
.prepareStatement("select next value for " + seqName + " as nextval");
} else if (driverName.contains(Const.DATABASE_ORACLE)) {
ps = this.getSession().connection()
.prepareStatement("select " + seqName + ".nextval from dual");
} else if (driverName.contains(Const.DATABASE_MYSQL)) {
//...
}
固定格式(从引号到代码块的模式),关闭范围。else子句丢失,所以现在将注释放在适当的位置。
SessionFactoryImpl factoryImpl = (SessionFactoryImpl)sessionFactoryObject;
Properties properties = factoryImpl.getProperties();
String dialect = properties.get("dialect").toString();