7 Replies Latest reply on Mar 29, 2007 11:04 AM by maxandersen

    Can't get seam generate-entities to work.

    kingcu

      Hi everyone,

      I have problem with the seam generate-entities command. After the following series of commands, nothing happened:

      1. seam setup (enter all the configuration information)
      2. seam new-project (new project created)
      3. seam generate-entities (I am supposed to get all the CRUD files created, but nothing happened)

      I suspect it could be the DB configuration part. I am using an Oracle database, username and password are correct "was"/"was". the only part I am not sure is the schema name, which seam setup asks for, I put in "was", same as the username.

      And by the way, is everyone using seam generate-entities to create the CRUD application code? OR is there other ways I am not aware of?

      Thanks,
      Tong

        • 1. Re: Can't get seam generate-entities to work.
          maxandersen

          hmm...the new tools should actually not care if your schema is lower or upper case ;(

          In any case that is probably the problem.

          Use WAS as your schema name. I can also be empty but then it will process the whole database and not just your schema (read: slower!)

          • 2. Re: Can't get seam generate-entities to work.
            kingcu

            Ok, it looks like lower/upper case does matter for seam-gen. I used "WAS" as the schema name, which matches exactly what I see in Oracle Enterprise Manager, however, I got the following exceptions. Any idea?


            Buildfile: C:\jboss-seam-1.2.1.GA\seam-gen\build.xml
            
            validate-workspace:
            
            validate-project:
            
            generate-entities:
            [hibernate] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
            [hibernate] 1. task: hbm2java (Generates a set of .java files)
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.cfg.Environment <clinit>
            [hibernate] INFO: Hibernate 3.2.0.cr5
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.cfg.Environment <clinit>
            [hibernate] INFO: hibernate.properties not found
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.cfg.Environment buildBytecodeProvider
            [hibernate] INFO: Bytecode provider name : cglib
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.cfg.Environment <clinit>
            [hibernate] INFO: using JDK 1.4 java.sql.Timestamp handling
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.cfg.reveng.OverrideRepository addFile
            [hibernate] INFO: Override file: C:\workspace\seam-gen-projects\seam-gen-was\resources\seam-gen.reveng.xml
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.connection.DriverManagerConnectionProvider configure
            [hibernate] INFO: Using Hibernate built-in connection pool (not for production use!)
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.connection.DriverManagerConnectionProvider configure
            [hibernate] INFO: Hibernate connection pool size: 20
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.connection.DriverManagerConnectionProvider configure
            [hibernate] INFO: autocommit mode: false
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.connection.DriverManagerConnectionProvider configure
            [hibernate] INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:wt
            [hibernate] Mar 29, 2007 9:48:07 AM org.hibernate.connection.DriverManagerConnectionProvider configure
            [hibernate] INFO: connection properties: {user=was, password=****}
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
            [hibernate] With the Partitioning, OLAP and Data Mining options
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: JDBC driver: Oracle JDBC driver, version: 10.2.0.1.0
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.dialect.Dialect <init>
            [hibernate] INFO: Using dialect: org.hibernate.dialect.OracleDialect
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
            [hibernate] INFO: Using default transaction strategy (direct JDBC transactions)
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
            [hibernate] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Automatic flush during beforeCompletion(): disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Automatic session close at end of transaction: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: JDBC batch size: 15
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: JDBC batch updates for versioned data: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Scrollable result sets: enabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: JDBC3 getGeneratedKeys(): disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Connection release mode: auto
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Default schema: WAS
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Default batch fetch size: 1
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Generate SQL with comments: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Order SQL updates by primary key: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
            [hibernate] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
            [hibernate] INFO: Using ASTQueryTranslatorFactory
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Query language substitutions: {}
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: JPA-QL strict compliance: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Second-level cache: enabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Query cache: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory createCacheProvider
            [hibernate] INFO: Cache provider: org.hibernate.cache.NoCacheProvider
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Optimize cache for minimal puts: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Structured second-level cache entries: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Statistics: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Deleted entity synthetic identifier rollback: disabled
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.SettingsFactory buildSettings
            [hibernate] INFO: Default entity-mode: pojo
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.reveng.JDBCReader processIndices
            [hibernate] WARNING: Exception while trying to get indexinfo on BIN$8J936SbLQsGfoSwymQr4HA==$0=Exception while getting index info for WAS.BIN$8J936SbLQsGfoSwymQr4HA==$0
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.cfg.reveng.JDBCReader processIndices
            [hibernate] WARNING: Exception while trying to get indexinfo on BIN$BlVHaFjNTbSN2ewoWXdmNg==$0=Exception while getting index info for WAS.BIN$BlVHaFjNTbSN2ewoWXdmNg==$0
            [hibernate] Mar 29, 2007 9:48:08 AM org.hibernate.connection.DriverManagerConnectionProvider close
            [hibernate] INFO: cleaning up connection pool: jdbc:oracle:thin:@localhost:1521:wt
            


            • 3. Re: Can't get seam generate-entities to work.
              maxandersen

              yes Oracle drivers have problems with index; so we just report it as an warning.

              • 4. Re: Can't get seam generate-entities to work.
                kingcu

                I didn't get the complete log when redirecting the output to a log file. Anyway, here is the last past of the output missing from my last post. As you can see, the build failed without creating the source files.

                [hibernate] An exception occurred while running exporter #2:hbm2java (Generates
                a set of .java files)
                [hibernate] To get the full stack trace run ant with -verbose
                [hibernate] org.hibernate.exception.DataException: Error while reading column me
                ta data for WAS.BIN$FjtksNI/SwSAiQ41i4iqZg==$0
                [hibernate] java.sql.SQLException: ORA-01424: missing or illegal character follo
                wing the escape character
                [hibernate]
                
                BUILD FAILED
                C:\jboss-seam-1.2.1.GA\seam-gen\build.xml:813: org.hibernate.exception.DataExcep
                tion: Error while reading column meta data for WAS.BIN$FjtksNI/SwSAiQ41i4iqZg==$
                0
                
                Total time: 2 seconds
                


                • 5. Re: Can't get seam generate-entities to work.
                  maxandersen

                  hmm...

                  add the following line to the reveng.xml file in your resources directory (assuming you use the latest release)


                  <table-filter match-name="BIN$.*" exclude="true"/>


                  • 6. Re: Can't get seam generate-entities to work.
                    kingcu

                    That worked for me. Thank you very much for the prompt help. BTW, the full file name is seam-gen.reveng.xml.

                    Also, is this a generic fix for using seam-gen with Oracle DB? OR it's just a fix for my specific situation?

                    • 7. Re: Can't get seam generate-entities to work.
                      maxandersen

                      generic fix for Oracle.

                      I'm actually surprised that it is picking these up - I would have expected it to use the more optimized OracleMetaDataDialect which filters these BIN$ tables out automatically and does not fail on index info.

                      You can try that by setting a property to:

                      hibernatetool.metadatadialect org.hibernate.cfg.reveng.dialect.OracleMetaDataDialect

                      in the seam-gen/build.properties file.