Hibernate 4.x + MySQL5 + Spatial woes

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Hibernate 4.x + MySQL5 + Spatial woes

Josh
> Hi Karel,
> >
> > I'm very keen on trying to get your work on hibernate-spatial working with current versions of Hibernate + MySQL5.  So far I have not had much luck and am inquiring as to the current status of the project.
> Wat versions of Hibernate + Hibernate Spatial did you try? HS 4.0-M12 should run fine in Hibernate 4.x and MySQL5. What errors do you get?

Hmm, is that a typo? I can only see branch HS 4.0-M2 and only see reference to artifact M1 on http://www.hibernatespatial.org/ .  Regardless I've tried everything on M1 and can't seem to get it to generate correct schema.

Also question why M2 isn't pushed to http://www.hibernatespatial.org/ ? Had a fun time getting Maven to include the right version of postgis-jdbc 1.5.2.

> > I had all but given up until I noticed you have activity on this branch here:
> This is the master branch that will eventually be integrated into Hibernate-core proper. From then on HS will be an integrated component of Hibernate. Currently progress is slow because of other (paid) project work.
> >
> > I have checked out this branch and created an hibernate-spatial-5.0.0jar.
> >
> > After including the jar in my project, setting the dialect to MySQL5SpatialInnoDBDialect and annotating my entity with:
> >     @Type(type="org.hibernate.spatial.JTSGeometryType")
> >
> >     private Point location;
> >
> > --
> >
> > Currently the behavior I am seeing is it creates a schema for the entity with a location column of type tinyblob.  I am expecting to see a geospacial type here, so I am a little bit puzzled by the tinyblob type.
> >
> > So my question is 1) Where should I go from here, why is my column being created with tinyblob.  2) What is the status of your project and do you have a roadmap you could share?
> It looks like Hibernate fails to determine the suitable Hibernate type to use, and reverts to the default (i.e. Serializable). Hibernate maps this to the schema type. Just remove the @Type annotation. In version 5 this is no longer necessary, and it probably confuses Hibernate's type determination. (Also make sure that you use Hibernate 5 - metamodel branch)

After removing the @Type annotation and including hibernate-core-5.0.0-snapshot compiled from HHH-6509+metamodel branch I am seeing the same behaviour unfortunately.  Not sure where to go next.

> You could check the matrix integration tests (although they are rather complicated). Last time I ran them, I had no problem with schema creation. Note: the matrix tests currently fail because of a problem in the matrix test gradle plugin.
> As to the road map: we're going to have this module integrated into Hibernate 5. So the road map is the same as for Hibernate.
> Btw, it's better to ask questions like this on the mailing list. You can register here: http://www.hibernatespatial.org/mail-lists.html

Done :)

> Regards,
> Karel

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate 4.x + MySQL5 + Spatial woes

Karel Maesen
Administrator
Hi Josh,

On 30 Jul 2013, at 18:33, Josh <[hidden email]> wrote:

> > Wat versions of Hibernate + Hibernate Spatial did you try? HS 4.0-M12 should run fine in Hibernate 4.x and MySQL5. What errors do you get?
>
> Hmm, is that a typo? I can only see branch HS 4.0-M2 and only see reference to artifact M1 on http://www.hibernatespatial.org/ .  Regardless I've tried everything on M1 and can't seem to get it to generate correct schema.

That's indeed a typo. I meant 4.0-M1

>
> Also question why M2 isn't pushed to http://www.hibernatespatial.org/ ? Had a fun time getting Maven to include the right version of postgis-jdbc 1.5.2.

I try to get some small changes into M2 first.  About the postgis-jdbc, I don't know why they don't publish this into maven central or some place. Now I have to deploy this myself I guess.

>
> After removing the @Type annotation and including hibernate-core-5.0.0-snapshot compiled from HHH-6509+metamodel branch I am seeing the same behaviour unfortunately.  Not sure where to go next.
>

So the behavior is that you get an incorrect schema right? No stacktraces or anything like that?

Could you verify that you see in the log file that the spatial dialect of MySQL is effectively loaded. If you rely on some kind of dialect resolving (either in Hibernate or Spring) you might end up with the wrong (non-spatial) dialect.

To identify the problem, you might download the tutorial code: https://github.com/maesenka/hibernate-spatial-tutorials and make the appropriate changes to configuration so that it runs on MySQL. The code is explained in the tutorial at http://www.hibernatespatial.org/tutorial-hs4.html.

If you don't have the problem with this tutorial code, changes are it is a configuration issue and you might be able to identify the problem. If this code doesn't work either, I can set it also up on my end and help identify the problem.

Regards,

Karel


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate 4.x + MySQL5 + Spatial woes

Josh
In reply to this post by Josh
Hi Karel,

So after trying out tutorial-hs4, it does appear to be working correctly with jdbc mysql + mysql5 server.  So the problem appears to be in the fact I am using JBoss AS7 as my web container.  Looking at the logs it does claim to be picking up the dialect:

17:50:51,603 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
17:50:51,606 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 8.4)
17:50:51,607 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI deployment: test-service.war
17:50:51,611 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011402: Starting Persistence Unit Service 'test-service.war#primary'
17:50:51,612 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH000204: Processing PersistenceUnitInfo [
name: primary
...]
17:50:51,679 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-2) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
17:50:51,685 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-2) HHH000400: Using dialect: org.hibernate.spatial.dialect.mysql.MySQLSpatialDialect
17:50:51,687 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC service thread 1-2) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
17:50:51,688 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-2) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
17:50:51,689 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-2) HHH000397: Using ASTQueryTranslatorFactory
17:50:51,853 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) HHH000227: Running hbm2ddl schema export

Wonder how I can debug this further.  Do you have any experience with the JBoss Application Server 7?

- Josh

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate 4.x + MySQL5 + Spatial woes

Karel Maesen
Administrator
Hi Josh,

Sorry, I have no experience with JBoss AS. Does this help: https://gist.github.com/bjornharrtell/3054462

Something else you could try is to create the schema manually, and then read/write to the database. That might give you a more helpful stacktrace.
       
Regards,

Karel


On 31 Jul 2013, at 01:53, Josh <[hidden email]> wrote:

> Hi Karel,
>
> So after trying out tutorial-hs4, it does appear to be working correctly with jdbc mysql + mysql5 server.  So the problem appears to be in the fact I am using JBoss AS7 as my web container.  Looking at the logs it does claim to be picking up the dialect:
>
> 17:50:51,603 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
> 17:50:51,606 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 8.4)
> 17:50:51,607 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI deployment: test-service.war
> 17:50:51,611 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011402: Starting Persistence Unit Service 'test-service.war#primary'
> 17:50:51,612 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH000204: Processing PersistenceUnitInfo [
> name: primary
> ...]
> 17:50:51,679 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-2) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
> 17:50:51,685 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-2) HHH000400: Using dialect: org.hibernate.spatial.dialect.mysql.MySQLSpatialDialect
> 17:50:51,687 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC service thread 1-2) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
> 17:50:51,688 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-2) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
> 17:50:51,689 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-2) HHH000397: Using ASTQueryTranslatorFactory
> 17:50:51,853 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) HHH000227: Running hbm2ddl schema export
>
> Wonder how I can debug this further.  Do you have any experience with the JBoss Application Server 7?
>
> - Josh
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate 4.x + MySQL5 + Spatial woes

Josh
One thing that I have to admit is very confusing about the hibernatespatial examples is they appear to favour PostgreSQL.  One of the required dependencies is postgis-1.5.3.jar. Is this jar required if one is targeting MySQL, how is it used by hibernate-spatial?

For example I am following that gist and they talk about putting the postgis jar in with the jdbc connector configuration for postgre.  That seems a bit odd translating this example to MySQL, having the postgis jar in same directory as the mysql jdbc connector.. but then again I suppose it can't hurt.

By now it should be apparent I am not a Java expert, but dreaming of a day I get all this stuff working together!!


On Wed, Jul 31, 2013 at 10:08 AM, Karel Maesen <[hidden email]> wrote:
Hi Josh,

Sorry, I have no experience with JBoss AS. Does this help: https://gist.github.com/bjornharrtell/3054462

Something else you could try is to create the schema manually, and then read/write to the database. That might give you a more helpful stacktrace.

Regards,

Karel


On 31 Jul 2013, at 01:53, Josh <[hidden email]> wrote:

> Hi Karel,
>
> So after trying out tutorial-hs4, it does appear to be working correctly with jdbc mysql + mysql5 server.  So the problem appears to be in the fact I am using JBoss AS7 as my web container.  Looking at the logs it does claim to be picking up the dialect:
>
> 17:50:51,603 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
> 17:50:51,606 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 8.4)
> 17:50:51,607 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI deployment: test-service.war
> 17:50:51,611 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011402: Starting Persistence Unit Service 'test-service.war#primary'
> 17:50:51,612 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH000204: Processing PersistenceUnitInfo [
> name: primary
> ...]
> 17:50:51,679 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-2) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
> 17:50:51,685 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-2) HHH000400: Using dialect: org.hibernate.spatial.dialect.mysql.MySQLSpatialDialect
> 17:50:51,687 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC service thread 1-2) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
> 17:50:51,688 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-2) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
> 17:50:51,689 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-2) HHH000397: Using ASTQueryTranslatorFactory
> 17:50:51,853 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) HHH000227: Running hbm2ddl schema export
>
> Wonder how I can debug this further.  Do you have any experience with the JBoss Application Server 7?
>
> - Josh
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate 4.x + MySQL5 + Spatial woes

Karel Maesen
Administrator
Hi Josh,

Never mind the postgis.jar -- this is really only necessary for Postgresql. The MySQL provider doesn't need or use it.

If you get everything to work, consider sharing your experience w.r.t JBoss AS with the community.

Best of luck,

Karel

On 01 Aug 2013, at 08:04, Josh <[hidden email]> wrote:

> One thing that I have to admit is very confusing about the hibernatespatial examples is they appear to favour PostgreSQL.  One of the required dependencies is postgis-1.5.3.jar. Is this jar required if one is targeting MySQL, how is it used by hibernate-spatial?
>
> For example I am following that gist and they talk about putting the postgis jar in with the jdbc connector configuration for postgre.  That seems a bit odd translating this example to MySQL, having the postgis jar in same directory as the mysql jdbc connector.. but then again I suppose it can't hurt.
>
> By now it should be apparent I am not a Java expert, but dreaming of a day I get all this stuff working together!!
>
>
> On Wed, Jul 31, 2013 at 10:08 AM, Karel Maesen <[hidden email]> wrote:
> Hi Josh,
>
> Sorry, I have no experience with JBoss AS. Does this help: https://gist.github.com/bjornharrtell/3054462
>
> Something else you could try is to create the schema manually, and then read/write to the database. That might give you a more helpful stacktrace.
>
> Regards,
>
> Karel
>
>
> On 31 Jul 2013, at 01:53, Josh <[hidden email]> wrote:
>
> > Hi Karel,
> >
> > So after trying out tutorial-hs4, it does appear to be working correctly with jdbc mysql + mysql5 server.  So the problem appears to be in the fact I am using JBoss AS7 as my web container.  Looking at the logs it does claim to be picking up the dialect:
> >
> > 17:50:51,603 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
> > 17:50:51,606 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 8.4)
> > 17:50:51,607 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI deployment: test-service.war
> > 17:50:51,611 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011402: Starting Persistence Unit Service 'test-service.war#primary'
> > 17:50:51,612 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH000204: Processing PersistenceUnitInfo [
> > name: primary
> > ...]
> > 17:50:51,679 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-2) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
> > 17:50:51,685 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-2) HHH000400: Using dialect: org.hibernate.spatial.dialect.mysql.MySQLSpatialDialect
> > 17:50:51,687 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC service thread 1-2) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
> > 17:50:51,688 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-2) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
> > 17:50:51,689 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-2) HHH000397: Using ASTQueryTranslatorFactory
> > 17:50:51,853 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) HHH000227: Running hbm2ddl schema export
> >
> > Wonder how I can debug this further.  Do you have any experience with the JBoss Application Server 7?
> >
> > - Josh
> > _______________________________________________
> > hibernatespatial-users mailing list
> > [hidden email]
> > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users