Search code examples
sql-servereclipsehibernatesql-server-2008hibernate-mapping

Hibernate reverse engineering in eclipse from SQL Server Express R2


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: enter image description here

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


Solution

  • 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.