-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: InnoDB & Schema Export/Eclipse plugin
PostPosted: Mon Oct 03, 2005 3:18 pm 
Beginner
Beginner

Joined: Wed Feb 23, 2005 2:23 pm
Posts: 21
Location: Pescara, italy
Hibernate version:
Hibernate version 3.0.5 (25.5.2005)

Mapping documents:
work all fine with MyISAM

Code between sessionFactory.openSession() and session.close():
works all fine with MyISAM

Full stack trace of any exception that occurs:
Error 2005-10-03 16:13:46.596 General error, message from server: "Can't create table './planets/#sql-15b0_19.frm' (errno: 150)"
java.sql.SQLException: General error, message from server: "Can't create table './planets/#sql-15b0_19.frm' (errno: 150)"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1070)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2027)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1984)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1248)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1194)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:280)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:246)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:189)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
at org.hibernate.eclipse.console.views.SchemaExportAction$1.execute(SchemaExportAction.java:56)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71)
at org.hibernate.eclipse.console.views.SchemaExportAction.doRun(SchemaExportAction.java:47)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:46)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:747)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3059)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2748)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)

Name and version of the database you are using:
MYSQL Server version 4.1.10a-standard
DB-Driver: mysql-connector-java-3.0.9-stable-bin.jar

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Eclipse / Plugins:
Eclipse SDK Version: 3.1.1
Hibernate Tools version 3.1.0.alpha5, 22 August 2005

Hi,

I worked quite some time and without problems with Hibernate using the sql dialect configuration:
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
Then I discovered that all my MySQL Tables are created as MyISAM and therefor not using transactions.

But switching to the SQL-Dialect org.hibernate.dialect.MySQLInnoDBDialect in my hibernate.cfg.xml results in an Exception when I run a schema-export with the hibernate-tools-3.1.0.alpha5.
The exception above is thrown 49 times identically.

I also tried to leave the working hibernate config org.hibernate.dialect.MySQLDialect but switch the MySQL Server default_table_type to InnoDB. Here again the same exception is thrown.

On the other hand, when I try to manually create tables in the DB with the InnoDB table type that works fine.

Any hints where my problem may lie?

Thanks
Kai


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 3:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what sql is schemaexport executing that makes this error occur ?

frankly - to me it looks like a driver/db bug.

cant imagine we were generating that kind of table names ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 7:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I would try an updated JDBC driver. Its not uncommon that the MySQL JDBC driver is at fault.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 9:19 am 
Beginner
Beginner

Joined: Wed Feb 23, 2005 2:23 pm
Posts: 21
Location: Pescara, italy
Thanks for your help. I updated to the current driver Version found on mysql.com but still I have the same problem.
within the hugh logfile I find also another Exception shown below.
Sorry Max, but although I turned on 'show-sql' in my hibernate.cfg.xml I have not found the sql script that is generated and executed by the hibernate plugin.
I looked in the /workspace/.metadata/.bak_x.log files.
Where is the SQL logged?

If it would be the driver/DB is there something I could try befor reinstalling the DB?

!ENTRY org.hibernate.eclipse.console 4 4 2005-10-06 15:02:50.834
!MESSAGE Error 3 while performing SchemaExport
!STACK 0
java.sql.SQLException: Error on rename of './planets/ANLAGE' to './planets/#sql2-152e-5' (errno: 152)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:929)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:280)
at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:263)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:185)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
at org.hibernate.eclipse.console.views.SchemaExportAction$1.execute(SchemaExportAction.java:56)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71)
at org.hibernate.eclipse.console.views.SchemaExportAction.doRun(SchemaExportAction.java:47)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:46)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:747)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3059)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2748)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
!SUBENTRY 1 org.hibernate.eclipse.console 4 4 2005-10-06 15:02:50.835
!MESSAGE Error on rename of './planets/ANLAGE' to './planets/#sql2-152e-5' (errno: 152)
!STACK 0
java.sql.SQLException: Error on rename of './planets/ANLAGE' to './planets/#sql2-152e-5' (errno: 152)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:929)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:280)
at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:263)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:185)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
at org.hibernate.eclipse.console.views.SchemaExportAction$1.execute(SchemaExportAction.java:56)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71)
at org.hibernate.eclipse.console.views.SchemaExportAction.doRun(SchemaExportAction.java:47)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:46)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:747)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3059)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2748)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
!SUBENTRY 2 org.hibernate.eclipse.console 4 150 2005-10-06 15:02:50.836


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 9:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
We dont execute sql when reverse engineering we call jdbc metadata functions.

Are you running from alpha5/6/ CVS ?

if alpha6 or cvs then there should be a log at

workspace\.metadata\.plugins\org.hibernate.eclipse\hibernate-tools.log

you can control the verbosity of that log via changing the hibernate-log4j.properties found at plugins\org.hibernate.eclipse\hibernate-log4j.properties

e.g. enable debug for org.hibernate.tools

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 10:22 am 
Beginner
Beginner

Joined: Wed Feb 23, 2005 2:23 pm
Posts: 21
Location: Pescara, italy
Thanks for the quick answer.
No, i dont use the cvs builds.

I found the log4j.property file deep down in jar archives but with all loggers set to debug.
I decided to start eclipse from the console to have the log statements seen on stdout.
If I execute the statements as to be found in the debug-log manually on the db they don't generate a warning or an error.

here are the statements to my tabel ANLAGE (but the error occures to all tables that are generated):

15:57:09,060 DEBUG SessionFactoryObjectFactory:76 - registered: 4028808706c6340b0106c63897440001 (unnamed)
15:57:09,060 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
15:57:09,061 DEBUG SessionFactoryImpl:297 - instantiated session factory
15:57:09,061 INFO SessionFactoryImpl:429 - Checking 0 named queries
15:57:11,561 INFO Dialect:100 - Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
15:57:11,563 INFO Configuration:995 - processing extends queue
15:57:11,565 INFO Configuration:999 - processing collection mappings
15:57:11,566 INFO Configuration:1008 - processing association property references
15:57:11,568 INFO Configuration:1030 - processing foreign key constraints

15:57:11,624 DEBUG Configuration:1081 - resolving reference to class: beans.Anlage

15:57:11,880 INFO SchemaExport:153 - Running hbm2ddl schema export
15:57:11,882 INFO SchemaExport:175 - exporting generated schema to database
15:57:11,883 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
15:57:11,885 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
15:57:11,886 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
15:57:11,888 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/planets

15:57:11,919 DEBUG SchemaExport:278 - alter table ANLAGE drop foreign key FK7359B2C05E899101
15:57:11,920 DEBUG SchemaExport:267 - Unsuccessful: alter table ANLAGE drop foreign key FK7359B2C05E899101
15:57:11,920 DEBUG SchemaExport:268 - Table 'planets.ANLAGE' doesn't exist
15:57:11,921 DEBUG SchemaExport:278 - alter table ANLAGE drop foreign key FK7359B2C09DD8B0C5
15:57:11,921 DEBUG SchemaExport:267 - Unsuccessful: alter table ANLAGE drop foreign key FK7359B2C09DD8B0C5
15:57:11,922 DEBUG SchemaExport:268 - Table 'planets.ANLAGE' doesn't exist
15:57:12,078 DEBUG SchemaExport:278 - drop table if exists ANLAGE
15:57:12,249 DEBUG SchemaExport:278 - create table ANLAGE (ANLAGEN_ID int UNSIGNED not null auto_increment, VERSION integer not null, STUFE smallint UNSIGNED not null, ANLAGENTYP_ID varchar(255), GEBAEUDE_ID varchar(255), primary key (ANLAGEN_ID)) type=InnoDB
15:57:15,620 DEBUG SchemaExport:278 - alter table ANLAGE add index FK7359B2C05E899101 (GEBAEUDE_ID), add constraint FK7359B2C05E899101 foreign key (GEBAEUDE_ID) references PRODUKTIONSGEBAEUDE (GEBAEUDE_ID)
15:57:15,760 DEBUG SchemaExport:278 - alter table ANLAGE add index FK7359B2C09DD8B0C5 (ANLAGENTYP_ID), add constraint FK7359B2C09DD8B0C5 foreign key (ANLAGENTYP_ID) references ANLAGENTYP (ANLAGENTYP_ID)
15:57:15,847 ERROR SchemaExport:253 - Unsuccessful: alter table ANLAGE add index FK7359B2C09DD8B0C5 (ANLAGENTYP_ID), add constraint FK7359B2C09DD8B0C5 foreign key (ANLAGENTYP_ID) references ANLAGENTYP (ANLAGENTYP_ID)
15:57:15,848 ERROR SchemaExport:254 - Can't create table './planets/#sql-152e_c.frm' (errno: 150)
15:57:25,553 INFO SchemaExport:195 - schema export complete
15:57:25,554 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
15:57:25,556 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:mysql://localhost:3306/planets


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.