metadataimpl.java
来自「用Java实现的23个常用设计模式源代码」· Java 代码 · 共 81 行
JAVA
81 行
package net.sf.hibernate.jca;import java.sql.SQLException;import javax.resource.ResourceException;import javax.resource.spi.ManagedConnectionMetaData;/** * * Implementation delegates to the database connection meta data object * */public class MetaDataImpl implements ManagedConnectionMetaData { private ManagedConnectionImpl mc; public MetaDataImpl(ManagedConnectionImpl mc) { this.mc = mc; } public String getEISProductName() throws ResourceException { String result = null; try { result = mc.getConnection().getMetaData().getUserName(); } catch (SQLException e) { final String message = "Exception getting product name"; final ResourceException re = new ResourceException(message); re.setLinkedException(e); throw re; } return result; } public String getEISProductVersion() throws ResourceException { String result = null; try { result = mc.getConnection().getMetaData().getDriverVersion(); } catch (SQLException e) { final String message = "Exception getting product version"; final ResourceException re = new ResourceException(message); re.setLinkedException(e); throw re; } return result; } public int getMaxConnections() throws ResourceException { int result = 0; try { result = mc.getConnection().getMetaData().getMaxConnections(); } catch (SQLException e) { final String message = "Exception getting max connections"; final ResourceException re = new ResourceException(message); re.setLinkedException(e); throw re; } return result; } public String getUserName() throws ResourceException { String result = null; try { result = mc.getConnection().getMetaData().getUserName(); } catch (SQLException e) { final String message = "Exception getting connection user name"; final ResourceException re = new ResourceException(message); re.setLinkedException(e); throw re; } return result; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?