List of usage examples for org.hibernate ScrollMode toResultSetType
public int toResultSetType()
From source file:org.jahia.utils.DatabaseUtils.java
License:Open Source License
public static ScrollMode getFirstSupportedScrollMode(ScrollMode fallback, ScrollMode... scrollModesToTest) { ScrollMode supportedMode = null;// w w w. j ava 2 s .co m Connection conn = null; try { conn = getDatasource().getConnection(); DatabaseMetaData metaData = conn.getMetaData(); for (ScrollMode scrollMode : scrollModesToTest) { if (metaData.supportsResultSetType(scrollMode.toResultSetType())) { supportedMode = scrollMode; break; } } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.warn("Unlable to check supported scrollable resultset type. Cause: " + e.getMessage(), e); } else { logger.warn("Unlable to check supported scrollable resultset type. Cause: " + e.getMessage()); } } finally { closeQuietly(conn); } return supportedMode != null ? supportedMode : fallback; }