facebook

PostgreSQL/PostGIS mapping problem

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #245270 Reply

    I’m having problem with Hibernate mapping (MyEclipse 4.1GA) of PostgreSQL table with PostGIS columns. When I try to map this table following error occures:

    !ENTRY org.eclipse.core.runtime 4 2 2006-01-25 12:54:12.364
    !MESSAGE An internal error occurred during: “Generating Artifacts”.
    !STACK 0
    org.hibernate.exception.GenericJDBCException: Getting database metadata
    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.getMetaData(JDBCMetaDataDialect.java:61)
    at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:70)
    at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:380)
    at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:62)
    at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration$1.readDatabaseSchema(MEJDBCMetaDataConfiguration.java:82)
    at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:85)
    at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:109)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$5.execute(GenerateArtifactsJob.java:393)
    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:388)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:255)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
    Caused by: org.postgresql.util.PSQLException: Unable to load the class org.postgis.PGbox3d responsible for the datatype box3d
    at org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes(AbstractJdbc2Connection.java:470)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:133)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
    at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
    at org.postgresql.Driver.connect(Driver.java:235)
    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.reveng.dialect.JDBCMetaDataDialect.getConnection(JDBCMetaDataDialect.java:292)
    at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getMetaData(JDBCMetaDataDialect.java:58)
    … 12 more
    Caused by: java.lang.ClassNotFoundException: org.postgis.PGbox3d
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes(AbstractJdbc2Connection.java:466)
    … 22 more

    Here is table generation script:

    CREATE TABLE maps.strom
    (
    gid serial NOT NULL,
    name varchar,
    the_geom maps.geometry,
    CONSTRAINT strom_pkey PRIMARY KEY (gid),
    CONSTRAINT enforce_dims_the_geom CHECK (maps.ndims(the_geom) = 2),
    CONSTRAINT enforce_geotype_the_geom CHECK (maps.geometrytype(the_geom) = ‘MULTILINESTRING’::text OR the_geom IS NULL),
    CONSTRAINT enforce_srid_the_geom CHECK (maps.srid(the_geom) = -1)
    )
    WITH OIDS;

    I’m using PostgreSQL 8.0.1 with built-in PostGIS v. 1.78.2.4.

    #245272 Reply

    Brian Fernandes
    Moderator

    Hi,

    A few questions: Does the RE process work for all other tables and fail only for this one? I’m assuming here that “the_geom” is your PostGIS column?

    Is your hibernate configuration file configured with the correct dialect? If you manually create the mapping file, does your hibernate application work fine?

    Best,
    Brian.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: PostgreSQL/PostGIS mapping problem

You must be logged in to post in the forum log in