- This topic has 31 replies, 13 voices, and was last updated 14 years, 4 months ago by support-shalini.
-
AuthorPosts
-
soarwolfMemberI’m having problems with Hibernate mapping generation with 4.1 GA.
Eclipse SDK: 3.1.2
MyEclipse: 4.1.1GA
Mysql: 5.0
Driver: mysql-connector-java-3.1.12-bin.jarCREATE TABLE users (
user_id int(24) unsigned NOT NULL auto_increment,
username varchar(50) NOT NULL,
password varchar(10) NOT NULL,
PRIMARY KEY(user_id)
);When I connect to the mysql, it is ok, I can see all the databases, but When I Hibernate mapping generation, it give me this error:
An internal error occurred during “Generating Artifacts”
Please help me.
Here is hibernate.cfg.xml<hibernate-configuration>
<session-factory>
<property name=”connection.username”>root</property>
<property name=”connection.url”>jdbc:mysql://localhost/demo</property>
<property name=”dialect”>org.hibernate.dialect.MySQLDialect</property>
<property name=”myeclipse.connection.profile”>vipinfo</property>
<property name=”connection.password”>password</property>
<property name=”connection.driver_class”>com.mysql.jdbc.Driver</property></session-factory>
</hibernate-configuration>
Thank you very much![/b]
soarwolfMemberand still the Myeclipse give me warnning
your hibernate project is configured for jdbc:mysql://localhost/Demo, but you are generating artifacts from jdbc:mysql://localhost/Demo.
Haris PecoMembersoarwolf ,
Can you post log for ‘Generating Artifacts’ error
Open Log Error view and paste content of this error in forum (view is in Windows-Show view-Other-PDE Runime-Error log view)Thanks
soarwolfMemberHello: snpe
Here is error log
java.lang.NullPointerException
at org.hibernate.console.FakeDelegatingDriver.connect(FakeDelegatingDriver.java:23)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1877)
at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:71)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$5.execute(GenerateArtifactsJob.java:405)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:400)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:266)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Haris PecoMemberHey soarwolf ,
It looks that you have typing error in hibernate.cfg.xml
Please check this line :
<property name=”connection.url”>jdbc:mysql://localhost/demo</property>
Is your database Demo or demo – set same database name like in database explorer
It’s better taht you edit hibernate.cfg.xml with MyEclipse configuration editor (when you have good setting for connection profile and you have it) and you simple choose connection profile – MyEclipse will do other for you.I suppose that your warning is
your hibernate project is configured for jdbc:mysql://localhost/Demo, but you are generating artifacts from jdbc:mysql://localhost/demo.
different is Demo and demo
Best regards
soarwolfMemberHey snpe
Thank you very much! I make mistake when i set up Database driver
Have a good day!
Haris PecoMemberHey soarwolf,
You are welcome.I’m glad for your success
Thank you
rteodosioMemberhello guys,
I am getting the same error when I am trying to Hibernate Reverse Engineering on MyEclipse 5. Have you guys encountered any problems in “Generating Artifacts” when doing this Reverse Engineering?
Thanks
Haris PecoMemberrteodosio ,
Please send us more details
– database and jdbc driver version and vendor
– error logPlease, open new thread
Thanks
Peco
rteodosioMemberHi Peco,
Here is my configuration in hibernate.cfg.xml.
I have used the preconfigure Database Driver in the DB Connect Profile. This set up this configuration below.
<?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”><!– Generated by MyEclipse Hibernate Tools. –>
<hibernate-configuration><session-factory>
<property name=”max_fetch_depth”>1</property>
<property name=”myeclipse.connection.profile”>SYB_NJES_DEV_02</property>
<property name=”connection.url”>jdbc:sybase:Tds:sybnjesdev02.ny.cantor.com:4200</property>
<property name=”connection.username”>rteodosio</property>
<property name=”connection.password”>espeed</property>
<property name=”connection.driver_class”>com.sybase.jdbc2.jdbc.SybDataSource</property>
<property name=”dialect”>org.hibernate.dialect.SybaseDialect</property></session-factory>
</hibernate-configuration>
I could drag and drop the tables from DB Browswer into Hibernate Mapping, but executing the reverse engineering mapping gives me the same error message.
Thanks,
Ron
rteodosioMemberHi Peco,
Here is the error log:
java.lang.NoSuchMethodError: org.apache.log4j.Category.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.Log4JCategoryLog.info(Log4JCategoryLog.java:109)
at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:41)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1877)
at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:71)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$6.execute(GenerateArtifactsJob.java:514)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:70)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:509)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:293)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)Thanks,
Ron
rteodosioMemberHi Peco,
After many head banging, the problem here is the version of log4j being used in hibernate as log provided this evidence:
java.lang.NoSuchMethodError: org.apache.log4j.Category.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)
in log4j version in the MyEclipse 5 uses Piority object instead of Level. I found an article talking about this incompatiblity:
Do you know by chance what version of log4j are you guys using in development of MyEclipse 5 in hibernate lib?
Thanks,
Ron
hidejayMemberHi, rteodosio,
Here is the error log:
org.hibernate.exception.GenericJDBCException: Could not get list of tables from database. Probably a JDBC driver problem.
Configured schema:dbo
Configured catalog:BookShop
<SQLException while getting schemas>
<SQLException while getting catalogs>
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.handleSQLException(JDBCMetaDataDialect.java:86)
at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:50)
at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:400)
at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65)
at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration$1.readDatabaseSchema(MEJDBCMetaDataConfiguration.java:102)
at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:87)
at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:134)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$6.execute(GenerateArtifactsJob.java:514)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:70)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:509)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:293)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.putTablePart(JDBCMetaDataDialect.java:203)
at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.access$000(JDBCMetaDataDialect.java:25)
at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDBCMetaDataDialect.java:77)
at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:47)
… 11 more
hidejayMemberHi Peco,
Here is my configuration in 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”><!– Generated by MyEclipse Hibernate Tools. –>
<hibernate-configuration><session-factory>
<property name=”connection.username”>sa</property>
<property name=”connection.url”>jdbc:odbc:LocalServer</property>
<property name=”myeclipse.connection.profile”>sqlserver</property>
<property name=”connection.driver_class”>
sun.jdbc.odbc.JdbcOdbcDriver
</property>
<property name=”dialect”>
org.hibernate.dialect.SQLServerDialect
</property></session-factory>
</hibernate-configuration>
hidejayMemberi’m a j2ee new learner,who can help me?
MSN:chelski2007@hotmail.com -
AuthorPosts