从SQL Server Express R2的eclipse中进行Hibernate逆向工程 [英] Hibernate reverse engineering in eclipse from SQL Server Express R2

查看:450
本文介绍了从SQL Server Express R2的eclipse中进行Hibernate逆向工程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Spring和Hibernate项目,我需要进行逆向工程。



我正在使用SQL Server Express R2 2008。



我已经生成了包含此源代码(hibernate.cfg.xml)的Hibernate控制台配置文件:

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE hibernate-configuration PUBLIC
- // Hibernate / Hibernate配置DTD 3.0 // EN
http://hibernate.sourceforge.net/hibernate-configuration-3.0 .dtd>
< hibernate-configuration>
< session-factory>
< property name =hibernate.connection.driver_class> net.sourceforge.jtds.jdbc.Driver< / property>
< property name =hibernate.connection.password> sa< / property>
< property name =hibernate.connection.url> jdbc:jtds:sqlserver:// localhost:1433 / monitoring< / property>
< property name =hibernate.connection.username> sa< / property>
< property name =hibernate.dialect> org.hibernate.dialect.SQLServerDialect< / property>
< property name =hibernate.default_schema> dbo< / property>
< / session-factory>
< / hibernate-configuration>

之后,我尝试生成Hibernate逆向工程文件(reveng.xml)。



我已经指定了配置,但是我总是遇到问题:


读取架构错误获取数据库元数据


如图所示:

只是为了澄清一些东西,有一些类似的话题。我读了他们,但他们并没有解决我的问题。

解决方案

问题出现在Server实例中。
默认情况下,SQL Server Express在1433端口上未侦听。
默认情况下禁用TCP / IP。



我在SQL Server配置管理器中解决了此问题。
我选择SQL Server网络配置,然后选择实例的协议。
我启用TCP / IP,然后我在TCP动态端口
中指定了1433之后,我重新启动了SQL Server实例。


I'm working on Spring and Hibernate Project and I need to make reverse engineering.

I'm working with SQL Server Express R2 2008.

I have generated the Hibernate console configuration file which contains this source code (hibernate.cfg.xml):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
        <property name="hibernate.connection.password">sa</property>
        <property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost:1433/supervision</property>
        <property name="hibernate.connection.username">sa</property>
        <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
        <property name="hibernate.default_schema">dbo</property>
    </session-factory>
</hibernate-configuration>

After that I tried to generate the Hibernate Reverse Engineering File (reveng.xml).

I have specified the configuration but I always get the problem:

Reading schema error getting database metadata

As it is show in this picture:

Just to clarify something, there are some topics similar to this. I read them but they don't solve my problem.

解决方案

The problem was in the Server instance. As default the SQL Server Express is not listening at 1433 port. The TCP/IP is disabled as default.

I solved this problem in SQL Server configuration manager which is installed with SQL Server. I chose SQL Server Network Configuration then Protocols for the Instance. I enabled the TCP/IP, then I specified 1433 in TCP Dynamic ports After that, I restarted the SQL Server Instance.

这篇关于从SQL Server Express R2的eclipse中进行Hibernate逆向工程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆