Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从maniplate db的hibernate模板中获取dailect对象_Hibernate_Jdbc_Database Design - Fatal编程技术网

如何从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();