java.lang.StackOverflowError when running seam generate-enti
christian_zeidler Jan 31, 2007 4:31 AMHello!
I tried to run a basic database model through the reverse enginering tool that comes with seam gen and I am getting a java.lang.StackOverflowError without any details.
Here is the output from running seam generate-entities (working with a configured project that works fine when running generate-entities with other tables):
Buildfile: F:\jboss\jboss-seam-1.1.0.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] 30.01.2007 19:01:04 org.hibernate.cfg.Environment <clinit> [hibernate] INFO: Hibernate 3.2 cr4 [hibernate] 30.01.2007 19:01:04 org.hibernate.cfg.Environment <clinit> [hibernate] INFO: hibernate.properties not found [hibernate] 30.01.2007 19:01:04 org.hibernate.cfg.Environment buildBytecodeProvider [hibernate] INFO: Bytecode provider name : cglib [hibernate] 30.01.2007 19:01:04 org.hibernate.cfg.Environment <clinit> [hibernate] INFO: using JDK 1.4 java.sql.Timestamp handling [hibernate] 30.01.2007 19:01:05 org.hibernate.connection.DriverManagerConnectionProvider configure [hibernate] INFO: Using Hibernate built-in connection pool (not for production use!) [hibernate] 30.01.2007 19:01:05 org.hibernate.connection.DriverManagerConnectionProvider configure [hibernate] INFO: Hibernate connection pool size: 20 [hibernate] 30.01.2007 19:01:05 org.hibernate.connection.DriverManagerConnectionProvider configure [hibernate] INFO: autocommit mode: false [hibernate] 30.01.2007 19:01:05 org.hibernate.connection.DriverManagerConnectionProvider configure [hibernate] INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///**** [hibernate] 30.01.2007 19:01:05 org.hibernate.connection.DriverManagerConnectionProvider configure [hibernate] INFO: connection properties: {user=----, password=****} [hibernate] 30.01.2007 19:01:06 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: RDBMS: MySQL, version: 5.0.27-community-nt [hibernate] 30.01.2007 19:01:06 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.4 ( $Date: 2006-10-19 17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision : 5908 $ ) [hibernate] 30.01.2007 19:01:07 org.hibernate.dialect.Dialect <init> [hibernate] INFO: Using dialect: org.hibernate.dialect.MySQLDialect [hibernate] 30.01.2007 19:01:07 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory [hibernate] INFO: Using default transaction strategy (direct JDBC transactions) [hibernate] 30.01.2007 19:01:07 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] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Automatic flush during beforeCompletion(): disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Automatic session close at end of transaction: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: JDBC batch size: 15 [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: JDBC batch updates for versioned data: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Scrollable result sets: enabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: JDBC3 getGeneratedKeys(): enabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Connection release mode: auto [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Maximum outer join fetch depth: 2 [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Default batch fetch size: 1 [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Generate SQL with comments: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Order SQL updates by primary key: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory [hibernate] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory [hibernate] 30.01.2007 19:01:07 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init> [hibernate] INFO: Using ASTQueryTranslatorFactory [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Query language substitutions: {} [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: JPA-QL strict compliance: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Second-level cache: enabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Query cache: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory createCacheProvider [hibernate] INFO: Cache provider: org.hibernate.cache.NoCacheProvider [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Optimize cache for minimal puts: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Structured second-level cache entries: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Statistics: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Deleted entity synthetic identifier rollback: disabled [hibernate] 30.01.2007 19:01:07 org.hibernate.cfg.SettingsFactory buildSettings [hibernate] INFO: Default entity-mode: pojo [hibernate] 30.01.2007 19:01:08 org.hibernate.connection.DriverManagerConnectionProvider close [hibernate] INFO: cleaning up connection pool: jdbc:mysql:///**** [hibernate] 30.01.2007 19:01:08 org.hibernate.tool.Version <clinit> [hibernate] INFO: Hibernate Tools 3.2.0.snapshotb9 30.01.2007 19:01:09 org.hibernate.connection.DriverManagerConnectionProvider close INFO: cleaning up connection pool: jdbc:mysql:///**** [hibernate] 2. task: generic exportertemplate: view/list.xhtml.ftl [hibernate] 3. task: generic exportertemplate: view/view.xhtml.ftl [hibernate] 4. task: generic exportertemplate: view/edit.page.xml.ftl BUILD FAILED java.lang.StackOverflowError Total time: 13 seconds
I was able to narrow it down to the use of a foreign key constraint referencing to the same table. Here is an example:
DROP TABLE IF EXISTS `people`; CREATE TABLE `people` ( `id` bigint NOT NULL, `given_name` varchar(20) NOT NULL default '0', `name` varchar(20) NOT NULL, `fk_likes_person` bigint default NULL, PRIMARY KEY (`id`), FOREIGN KEY (fk_likes_person) REFERENCES people(id) ON DELETE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
According to MySQL Documentation this is possible with InnoDB tables
...Note that InnoDB supports foreign key references within a table. In these cases, "child table records" really refers to dependent records within the same table...
Is there a good reason for this behaviour? If you consider this as a bug, please point me to the right place for reporting it.
- Christian