Error connecting to db with jboss tools / hibernate configuration
I'm attempting to use jboss tools hibernate code generation to generate DAOs and hibernate mappings for tables in my postgresql db. I have set-up my hibernate configuration but when I try to connect I get this error:
java.lang.NoSuchFieldError: INSTANCE at org.hibernate.type.StandardBasicTypes.<clinit>(StandardBasicTypes.java:54) at org.hibernate.spatial.dialect.postgis.PostgisDialect.registerTypesAndFunctions(PostgisDialect.java:55) at org.hibernate.spatial.dialect.postgis.PostgisDialect.<init>(PostgisDialect.java:42) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:157) at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:109) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:146) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2155) at org.hibernate.console.ConsoleConfiguration$6.execute(ConsoleConfiguration.java:430) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107) at org.hibernate.console.ConsoleConfiguration.getSettings(ConsoleConfiguration.java:428) at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:119) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107) at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:115) at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:65) at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106) at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
I've looked inside StandardBasicTypes at line 54, which reads
public static final BooleanType BOOLEAN = BooleanType.INSTANCE; and I've followed the field BooleanType.INSTANCE that does exist in class BooleanType.
I'm using hibernate-core-4.1.8.Final.jar, hibernate-spatial-4.0-M1.jar, and in my hibernate configuration, "Hibernate Version" is "4.0".
Check if you dont have two hibernate version on your classpath
JBoss Tools, Create a JPA Project and Connect to the Sakila-h2 Database Hibernate Tools provides a wizard to generate the hibernate.cfg.xml file if required. To create a Hibernate Configuration haltOnError: Halts the build process if an error occurs. I'm connecting to a production Oracle 10g database and attempting to generate a Hibernate configuration file using the hibernate3-maven-plugin running in Maven. However when I run the hibernate3:hbm2java goal I get the following error: An association from the table FOO refers to the unmapped class com.whatever.domain.Bar
The problem had to do with my hibernate configuration, specifically the driver and dialect. Originally, I had
<property name="hibernate.connection.driver_class">org.postgis.DriverWrapper</property> <property name="hibernate.dialect">org.hibernate.spatial.dialect.postgis.PostgisDialect</property>
And I was receiving the error stack trace in the question above. I changed these properties to
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
And was able to connect to the db through hibernate tools. If anyone cares, I created a JIRA here to track the issue should anyone want to be able to use hibernate tools with geospatial objects.
Hibernate Tools, Flexible Connections. JPA, Hibernate, DTP. features hibernate dbconnectiontypes. You can choose to use the database connection info from� Generate basic typed composite ids. When a table that has a multi-column primary key a <composite-id>mapping will always be created. If this option is enabled and there are matching foreign-keys, each key column is still considered a 'basic' scalar (string, long, etc.) instead of a reference to an entity.
Apparently all of your Hibernate jars and it's configuration in the editor need to match. Geofflittle's answer is spot on only if you make sure that your hibernate-spatial + hibernate-core + hibernate version selection in the editor drop-down are all at the same version.
Error viewing tables of database with hibernate tools, tools. I set up a new Java project and created hibernate configuration file an… Error viewing tables of database with hibernate tools The connection seems to work, as the availabe schemas/catalogs are shown. But what SUBENTRY 1 org.hibernate.eclipse.console 4 150 2018-05-07 19:12:22.007 ! In the Database connection field, click New to configure a new database connection or leave as is to use the default connection. In the Property file field, click Setup to set the path to the first hibernate.properties file found in the selected project (refer to the Did You Know, Setup Property File section for detailed steps).
[JBIDE-26569] Cannot create hibernate config file for hibernate 5.3 , Import project: https://github.com/jbosstools/jbosstools-hibernate/tree/master/ itests/org. Have running database from https://github.com/maxandersen/sakila- h2 Andr�: I had to change the Connection URL: to the following (sakila h2 server is kept open, no error dialog is show but the following error is in the Eclipse log: "Hibernate Tools" allows create configuration into a database connection or retrieve the connection information that you have previously declared. be found by
[JBIDE-26685] Create Hibernate Console Configuration wizard , Uploaded image for project: 'Tools (JBoss Tools)'. Tools (JBoss Tools) Bug - A problem which impairs or prevents the functions of the product. JBIDE-26569 Cannot create hibernate config file for hibernate 5.3 and 5.4. Critical - An upcoming The Database dialect needs to be filled manually (My SQL). Press Finish. Hibernate Tools provide a code generation launch configuration which can take the configured Hibernate model and use for various code generation tasks. Since it is a launch configuration it is easy to run it repeatedly while developing via the Launch Configuration menu.
I've set up a hibernate configuration with the existing hibernate.cfg.xml file and a postgres connection. I've validated that the database connection works using the "Test Connection" button in the connection configuration window and it said "Ping succeeded". The configuration rebuilds successfully and I can open the HQL Editor and run queries.
- I don't believe multiple versions of the hibernate jars are on the classpath but I'm not 100%. How would I check without a doubt if this is the case?
- if you are on eclipse right click on project - Properties - JavaBuild Path - Libraries.
- The only hibernate jars listed in libraries are hibernate-commons-annotations-4.0.1, hibernate-core-4.1.8, hibernate-jpa-2.0, hibernate-spatial-4.0.