我正在尝试将几何对象存储到我的 MS-SQL 数据库中,该数据库有一个带有几何列的表。我以 JSON 格式获取几何图形。在这里,我得到了最新的 MSSQL-JDBC 版本,它具有数据类型'com.microsoft.sqlserver.jdbc.Geometry'。在 maven 中包含所需的依赖项后,此数据类型可用pom.xml。但是,当我'com.microsoft.sqlserver.jdbc.Geometry'在 java Entity 类中提到我的 MS-SQL 几何列数据类型之一并运行该应用程序时,它会引发如下错误:> Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: com.microsoft.sqlserver.jdbc.Geometry, at table: GeoTable, for columns: [org.hibernate.mapping.Column(request_point)]下面是代码示例,Entity classimport com.microsoft.sqlserver.jdbc.Geometry;@Column(name = "request_point", columnDefinition = "Geometry")private Geometry request_point;pom.xml : <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <exclusions> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> </exclusion> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency>我不明白为什么我的几何数据类型没有被加载,让我知道我是否遗漏了任何东西或任何其他方法来做同样的事情。任何帮助将不胜感激。
添加回答
举报
0/150
提交
取消