如何告诉Hibernate使用代理?

问题描述 投票:0回答:1

当前使用Hibernate进行对象持久化,并以Snowflake作为我的数据库。当Hibernate尝试连接并提交到数据库时挂起。这是因为我的公司要求我们通过proxy

连接。

我阅读了文档here。该文档没有定义如何通过代理连接Hibernate ...是否支持? Hibernate如何连接到代理上的对象,或者甚至有可能?

我的Hibernate配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory name="MySessionFactory">
        <property name="hibernate.connection.driver_class">net.snowflake.client.jdbc.SnowflakeDriver</property>
        <property name="hibernate.connection.password">****</property>
        <property name="hibernate.connection.url">jdbc:snowflake://made.up.location.snowflakecomputing.com</property>
        <property name="hibernate.connection.username">myUsername</property>
        <property name="hibernate.default_schema">mySchema</property>
        <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
        <property name="show_sql">true</property>
        <property name="hibernate.c3p0.timeout">100</property>

    </session-factory>
</hibernate-configuration>

我希望我们可以以与此类似的方式定义属性:

Properties properties = new Properties();

        properties.put("user", "myUser");
        properties.put("password", "myPassword");
        properties.put("warehouse", "warehouseName");
        properties.put("db", "databaseName");
        properties.put("schema", "mySchema");
        properties.put("role", "myRole");
        properties.put("proxyHost", "proxy.myServer.com");
        properties.put("proxyPort", "80");
        properties.put("useProxy", "true");

关于如何进行这项工作的任何想法?

hibernate jdbc proxy snowflake-data-warehouse
1个回答
0
投票

这里是将Hibernate与Snowflake连接的良好链接。https://www.cdata.com/kb/tech/snowflake-jdbc-hibernate.rst

© www.soinside.com 2019 - 2024. All rights reserved.