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

Hibernate JIRA | Jose | 1 decade ago
  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
  3. 0

    Error!!!! Please Help me

    Oracle Community | 1 decade ago | 843854
    com.sybase.jdbc2.jdbc.SybSQLException: escritorio not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    unable to modify sp_dboption from JDBC connection

    Google Groups | 1 decade ago | Marc Slemko
    com.sybase.jdbc2.jdbc.SybSQLException: Database option doesn't exist or can't be set by user.
  6. 0

    FOR UPDATE can not be used in a SELECT

    Oracle Community | 1 decade ago | 3004
    com.sybase.jdbc2.jdbc.SybSQLException: FOR UPDATE can not be used in a SELECT which is not part of the declaration of a cursor or which is not inside a stored procedure.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    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