4 Replies Latest reply on Feb 14, 2008 10:55 AM by mars1412

    seam gen and MS SQL server

    mars1412 Apprentice

      when I  run seam-gen on an SQL server database, it seems that seam-gen tries to generate entites for all tables in the database, which gives me errors like this one:


      [hibernate] 13.02.2008 15:04:43 org.hibernate.cfg.reveng.JDBCReader processPrimaryKey
      [hibernate] WARNUNG: The JDBC driver didn't report any primary key columns in CHECK_CONSTRAINTS. Asking rev.eng. strateg
      y
      [hibernate] 13.02.2008 15:04:43 org.hibernate.cfg.reveng.JDBCReader processPrimaryKey
      [hibernate] WARNUNG: Rev.eng. strategy did not report any primary key columns for CHECK_CONSTRAINTS



      I tried to use the catalog property of seam setup, but this didn't work


      my connection settings:


      jdbc:sqlserver://localhost\dbact24:1433



      where dbact24 is my database: the only one except for the system databases


      any ideas?

        • 1. Re: seam gen and MS SQL server
          Kent Fletcher Newbie

          I just ran into this lately.  The catalog and schema properties are important for seam-gen and sql2k5.  Usually the catalog name is the same as the database name.  Then enter your schema name also in the 'seam setup'.  Also include your database (catalog) in your connection string.  I finally got it working after I did this things.




          jdbc:sqlserver://localhost\\dbact24:1433;databaseName=yourDatabaseName



          • 2. Re: seam gen and MS SQL server
            Kent Fletcher Newbie

            Here is an example of my connect string url.



            jdbc:sqlserver://CATL0DB49\DEVECOM:1433;databaseName=Test_Kent



            And Test-Kent would be the catalog name.

            • 3. Re: seam gen and MS SQL server
              mars1412 Apprentice

              thanks for the reply - I got it to work now
              I forgot to set the schema correctly (dbo in my case)
              complete seam-gen setup:


                  [input] Enter the filesystem path to the JDBC driver jar [Z:\programme\Databases\MS Sql Server\MSSQL_JDBC\Microsoft
              SQL Server 2005 JDBC Driver\sqljdbc_1.2\enu\sqljdbc.jar] [Z:\programme\Databases\MS Sql Server\MSSQL_JDBC\Microsoft SQL
              Server 2005 JDBC Driver\sqljdbc_1.2\enu\sqljdbc.jar]
              
              
                  [input] Enter JDBC driver class for your database [com.microsoft.sqlserver.jdbc.SQLServerDriver] [com.microsoft.sqls
              erver.jdbc.SQLServerDriver]
              
                  [input] Enter the JDBC URL for your database [jdbc:sqlserver://localhost\dbact24:1433;databaseName=dbact24] [jdbc:sq
              lserver://localhost\dbact24:1433;databaseName=dbact24]
              
                  [input] Enter database username [act24] [act24]
              
                  [input] Enter database password [act24] [act24]
              
                  [input] Enter the database schema name (it is OK to leave this blank) [dbo] [dbo]
              
                  [input] Enter the database catalog name (it is OK to leave this blank) [dbact24] [dbact24]


              • 4. Re: seam gen and MS SQL server
                mars1412 Apprentice

                note: in a production database you should not use the default (dbo) schema and you should use a slightly better password :)