-->
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.  [ 11 posts ] 
Author Message
 Post subject: Eclipse: "Problem while reading database schema" w
PostPosted: Wed Jul 26, 2006 10:08 am 
Beginner
Beginner

Joined: Fri Aug 27, 2004 1:59 pm
Posts: 33
When I create the SessionFactory I get the below exception. The Configuration view does end up showing the /table/ names (as opposed to class names), but does not show any details for the tables. Of couse HQL queries don't work at all. I get the error "HQL was valid, but no SQL generated. Your configuration most likely does not have any mappings defined."

Any clues would be much appreciated.

Code:
org.hibernate.exception.GenericJDBCException: Error while reading column meta data for kaplanb.dbo.fn_usernature
   at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
   at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getColumns(JDBCMetaDataDialect.java:232)
   at org.hibernate.cfg.reveng.JDBCReader.processBasicColumns(JDBCReader.java:501)
   at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:79)
   at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$1.execute(LazyDatabaseSchemaWorkbenchAdapter.java:76)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
   at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:67)
   at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:36)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:73)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: com.sybase.jdbc3.jdbc.SybSQLException: The 'CREATE TABLE' command is not allowed within a multi-statement transaction in the 'tempdb_developers' database.

   at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
   at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
   at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
   at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
   at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
   at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source)
   at com.sybase.jdbc3.jdbc.SybCallableStatement.executeQuery(Unknown Source)
   at com.sybase.jdbc3.jdbc.SybDatabaseMetaData.if(Unknown Source)
   at com.sybase.jdbc3.jdbc.SybDatabaseMetaData.getColumns(Unknown Source)
   at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getColumns(JDBCMetaDataDialect.java:210)
   ... 9 more

_________________
-barry
---------------------
polly want-a point?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 10:15 am 
Beginner
Beginner

Joined: Fri Aug 27, 2004 1:59 pm
Posts: 33
I found some info on this problem in the myeclipse forum (http://www.myeclipseide.com/PNphpBB2+fi ... 11159.html).

That thread seems to imply that the myeclipse team will fix this in their version of the hibernate tools. Do those guys ever give back the fixes to the hibernate team?

_________________
-barry
---------------------
polly want-a point?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 10:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the issue is that sybase driver for some reason want to create tables or something when we ask for metadata - weird stuff.

a workaround is to set hibernate.connection.autocommit to true.
(remember to do it just for usage of the reverse engineering, not when you actually use hibernate in your applicaiton)

Regarding MyEclipse then I haven't received any patches to hibernate tools core. I do have a copy of the changes they did initially where they disabled many features. So, i'm still awaiting to receive whatever new patches/contributions from them.....

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 11:15 am 
Beginner
Beginner

Joined: Fri Aug 27, 2004 1:59 pm
Posts: 33
Well, I did search here first of course, but I did not find these forum threads at first for some reason (there goes another point):

http://forum.hibernate.org/viewtopic.ph ... ngineering

However, I have both set tempdb to allow ddl in transactions (ddl in tran) /and/ added <property name="hibernate.connection.autocommit">true</property> to my configuration and still see the same problem....

_________________
-barry
---------------------
polly want-a point?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 11:15 am 
Beginner
Beginner

Joined: Fri Aug 27, 2004 1:59 pm
Posts: 33
Well, I did search here first of course, but I did not find these forum threads at first for some reason (there goes another point):

http://forum.hibernate.org/viewtopic.ph ... ngineering

However, I have both set tempdb to allow ddl in transactions (ddl in tran) /and/ added <property name="hibernate.connection.autocommit">true</property> to my configuration and still see the same problem....

_________________
-barry
---------------------
polly want-a point?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 11:17 am 
Beginner
Beginner

Joined: Fri Aug 27, 2004 1:59 pm
Posts: 33
Ok, closing and opening the session facotry did nto work; disconnecting and reconnecting the connecton did not work. But, restarting hibernate did indeed work. :-)

_________________
-barry
---------------------
polly want-a point?


Top
 Profile  
 
 Post subject: ... but hql does still does not work ...
PostPosted: Wed Jul 26, 2006 11:20 am 
Beginner
Beginner

Joined: Fri Aug 27, 2004 1:59 pm
Posts: 33
(since I have this thread open) The table properties are indeed populated now, but what is displayed is the database table names and database columns -- not classes and properties. From the ide manual, it appeared as if I should be seeing classes not tables.

In addition, HQL queries fail with "HQL was valid, but no SQL generated. Your configuration most likely does not have any mappings defined." If I remove the outptut directories that include the Entity's, I get errors indicating that the entities cannot be found. This is confusing.

_________________
-barry
---------------------
polly want-a point?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 11:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
memelet wrote:
Well, I did search here first of course, but I did not find these forum threads at first for some reason (there goes another point):


don't worry - tools questions are "free"

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 11:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
huh? you should definitly only see table and column names under the Database node.

Did you add any mapping files to the hibernate.cfg.xml file ? (maybe you did not remember to check the "hibernate.cfg.xml" exporter when you performed your reverse engineering ?)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 11:42 am 
Beginner
Beginner

Joined: Fri Aug 27, 2004 1:59 pm
Posts: 33
Sorry, the Database node is just that. The docs show the classes in the Configuration node. I'm not getting any classes in that node because my @Entity's are not being autodiscovered.


I can explicity list the classes the cfg.xml file, but would really like the plugin to scan the classpath I gave it for @Entity's et all. Is that possible?

I am not doing using reverse engineering, and don't really have a production cfg.xml file in any case because its pretty much a JPA application configured via spring. Do I need to reverse the cfg.xml file to use the plugin?

_________________
-barry
---------------------
polly want-a point?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 1:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ah ok - so yes, currently you have to list the entities explicitly in the cfg.xml for it to work.

I'm still waiting for emmanuel (or me ;) to add a hook in our ejb3 impl to give the result of an autodiscovery and thus avoid creating a complete EntityManagerFactory just for this.

We will get it and persistence.xml support soon.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 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.