org.hibernate.exception.GenericJDBCException: Exception while reading foreign key meta data

Hibernate JIRA | Jose | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Hibernate Artifact Generator throws "Exception while reading foreign key meta data" exception with Sybase databases GetExportedKeys call on the Sybase driver is throwing the "No such object or user exists in the database" exceptoin as follows: org.hibernate.exception.GenericJDBCException: Exception while reading foreign key meta data at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70) at org.hibernate.cfg.reveng.JDBCReader.processForeignKeys(JDBCReader.java:152) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:688) at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:122) at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:89) at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:249) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:246) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:165) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:133) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:99) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) Caused by: com.sybase.jdbc2.jdbc.SybSQLException: No such object or user exists in the database. at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:3069) at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2373) at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69) at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:220) at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:203) at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1705) at com.sybase.jdbc2.jdbc.SybCallableStatement.executeQuery(SybCallableStatement.java:103) at com.sybase.jdbc2.jdbc.SybDatabaseMetaData.returnResults(SybDatabaseMetaData.java:2541) at com.sybase.jdbc2.jdbc.SybDatabaseMetaData.getExportedKeys(SybDatabaseMetaData.java:2091) at com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getExportedKeys(NewProxyDatabaseMetaData.java:3088) at org.hibernate.cfg.reveng.JDBCReader.processForeignKeys(JDBCReader.java:90) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:688) at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:122) at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:89) at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:249) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:246) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:165) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:133) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:99) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) The suggested workaround is as follows: as you know, the exception is thrown in JDBCReader.java by the getExportedKeys() line: exportedKeyRs = getMetaData().getExportedKeys(referencedTable.getCatalog(), referencedTable.getSchema(), referencedTable.getName() ); as mentioned, this problem is the same as Cayenne encountered in their CayenneModeler GUI tool (the equivalent to the Hibernate Artifact Generator GUI) - as explained here: http://www.objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-182 Cayenne's solution to this problem was simply to catch the exception. Obviously this means that no foreign key information will be collected, but this is still better than not being able to run the Hibernate Artefact Generator at all for Sybase databases. At the moment the exception is being caught, and then another is re-thrown - The possible workaround suggested is to not rethrow the exception for sybase databases. Notes: From my experience in most Sybase environments most people don't bother specifying Foreign Keys so we will not be losing any practical functionality. Implemented this workaround might fix the problem, but I dont know if implementing it will have a side-effect on the rest of the code. It shouldn't as it should work as if the relevant database table has no foreign keys (which is the usual case).

    Hibernate JIRA | 1 decade ago | Jose
    org.hibernate.exception.GenericJDBCException: Exception while reading foreign key meta data
  2. 0

    Hibernate Artifact Generator throws "Exception while reading foreign key meta data" exception with Sybase databases GetExportedKeys call on the Sybase driver is throwing the "No such object or user exists in the database" exceptoin as follows: org.hibernate.exception.GenericJDBCException: Exception while reading foreign key meta data at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70) at org.hibernate.cfg.reveng.JDBCReader.processForeignKeys(JDBCReader.java:152) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:688) at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:122) at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:89) at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:249) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:246) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:165) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:133) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:99) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) Caused by: com.sybase.jdbc2.jdbc.SybSQLException: No such object or user exists in the database. at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:3069) at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2373) at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69) at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:220) at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:203) at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1705) at com.sybase.jdbc2.jdbc.SybCallableStatement.executeQuery(SybCallableStatement.java:103) at com.sybase.jdbc2.jdbc.SybDatabaseMetaData.returnResults(SybDatabaseMetaData.java:2541) at com.sybase.jdbc2.jdbc.SybDatabaseMetaData.getExportedKeys(SybDatabaseMetaData.java:2091) at com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getExportedKeys(NewProxyDatabaseMetaData.java:3088) at org.hibernate.cfg.reveng.JDBCReader.processForeignKeys(JDBCReader.java:90) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:688) at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:122) at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:89) at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:249) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:246) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:165) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:133) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:99) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) The suggested workaround is as follows: as you know, the exception is thrown in JDBCReader.java by the getExportedKeys() line: exportedKeyRs = getMetaData().getExportedKeys(referencedTable.getCatalog(), referencedTable.getSchema(), referencedTable.getName() ); as mentioned, this problem is the same as Cayenne encountered in their CayenneModeler GUI tool (the equivalent to the Hibernate Artifact Generator GUI) - as explained here: http://www.objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-182 Cayenne's solution to this problem was simply to catch the exception. Obviously this means that no foreign key information will be collected, but this is still better than not being able to run the Hibernate Artefact Generator at all for Sybase databases. At the moment the exception is being caught, and then another is re-thrown - The possible workaround suggested is to not rethrow the exception for sybase databases. Notes: From my experience in most Sybase environments most people don't bother specifying Foreign Keys so we will not be losing any practical functionality. Implemented this workaround might fix the problem, but I dont know if implementing it will have a side-effect on the rest of the code. It shouldn't as it should work as if the relevant database table has no foreign keys (which is the usual case).

    Hibernate JIRA | 1 decade ago | Jose
    org.hibernate.exception.GenericJDBCException: Exception while reading foreign key meta data

    Root Cause Analysis

    1. com.sybase.jdbc2.jdbc.SybSQLException

      No such object or user exists in the database.

      at com.sybase.jdbc2.tds.Tds.processEed()
    2. com.sybase.jdbc2
      SybDatabaseMetaData.getExportedKeys
      1. com.sybase.jdbc2.tds.Tds.processEed(Tds.java:3069)
      2. com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2373)
      3. com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
      4. com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:220)
      5. com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:203)
      6. com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1705)
      7. com.sybase.jdbc2.jdbc.SybCallableStatement.executeQuery(SybCallableStatement.java:103)
      8. com.sybase.jdbc2.jdbc.SybDatabaseMetaData.returnResults(SybDatabaseMetaData.java:2541)
      9. com.sybase.jdbc2.jdbc.SybDatabaseMetaData.getExportedKeys(SybDatabaseMetaData.java:2091)
      9 frames
    3. c3p0:JDBC DataSources/Resource Pools
      NewProxyDatabaseMetaData.getExportedKeys
      1. com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getExportedKeys(NewProxyDatabaseMetaData.java:3088)
      1 frame
    4. Hibernate Tools
      JDBCReader.readDatabaseSchema
      1. org.hibernate.cfg.reveng.JDBCReader.processForeignKeys(JDBCReader.java:90)
      2. org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65)
      3. org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:688)
      3 frames
    5. Hibernate
      JDBCMetaDataConfiguration.readFromJDBC
      1. org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:122)
      2. org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:89)
      3. org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40)
      3 frames
    6. org.hibernate.eclipse
      ArtifactGeneratorWizard$3.execute
      1. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:249)
      1 frame
    7. org.hibernate.console
      ConsoleConfiguration.execute
      1. org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
      2. org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:71)
      2 frames
    8. org.hibernate.eclipse
      ArtifactGeneratorWizard$1.run
      1. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:246)
      2. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:165)
      3. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:133)
      4. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:99)
      4 frames
    9. JFace
      ModalContext$ModalContextThread.run
      1. org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
      1 frame