我无法看到空间相关查询的绑定参数。 log4j配置与非空间查询一起工作正常但不能使用空间。我在这里做错了吗?
使用hibernate 4.2,Spatial 4.0& slf4j-log4j12 1.5.11
的log4j.xml
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Root logger option
log4j.rootLogger=INFO, stdout
# Hibernate logging options (INFO only shows startup messages)
log4j.logger.org.hibernate=INFO
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.tool.hbm2ddl=debug
# Log JDBC bind parameter runtime arguments
log4j.logger.org.hibernate.type=TRACE
log4j.logger.org.hibernate.type.descriptor.sql=TRACE
log4j.logger.org.hibernate.loader.hql=trace
控制台输出
20:03:49,509 INFO Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
20:03:49,516 INFO Version:41 - HHH000412: Hibernate Core {4.2.0.Final}
20:03:49,519 INFO Environment:239 - HHH000206: hibernate.properties not found
20:03:49,520 INFO Environment:342 - HHH000021: Bytecode provider name : javassist
20:03:49,541 INFO Configuration:1933 - HHH000043: Configuring from resource: /hibernate.cfg.xml
20:03:49,541 INFO Configuration:1952 - HHH000040: Configuration resource: /hibernate.cfg.xml
20:03:49,586 WARN DTDEntityResolver:74 - HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
20:03:49,617 INFO Configuration:2074 - HHH000041: Configured SessionFactory: null
20:03:49,840 INFO DriverManagerConnectionProviderImpl:98 - HHH000402: Using Hibernate built-in connection pool (not for production use!)
20:03:49,847 INFO DriverManagerConnectionProviderImpl:134 - HHH000115: Hibernate connection pool size: 1
20:03:49,848 INFO DriverManagerConnectionProviderImpl:137 - HHH000006: Autocommit mode: false
20:03:49,848 INFO DriverManagerConnectionProviderImpl:151 - HHH000401: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/postgistest]
20:03:49,848 INFO DriverManagerConnectionProviderImpl:156 - HHH000046: Connection properties: {user=postgres, password=****}
20:03:50,151 INFO Dialect:128 - HHH000400: Using dialect: org.hibernate.spatial.dialect.postgis.PostgisDialect
20:03:50,162 INFO LobCreatorBuilder:120 - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
20:03:50,173 INFO TransactionFactoryInitiator:68 - HHH000399: Using default transaction strategy (direct JDBC transactions)
20:03:50,179 INFO ASTQueryTranslatorFactory:48 - HHH000397: Using ASTQueryTranslatorFactory
20:03:50,196 TRACE TypeFactory:72 - Scoping types to session factory org.hibernate.internal.SessionFactoryImpl@73b58550
20:03:50,209 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.Geometry -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,209 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.Point -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,209 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.Polygon -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,210 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.MultiPolygon -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,210 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.LineString -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,210 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.MultiLineString -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,210 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.MultiPoint -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,211 DEBUG BasicTypeRegistry:148 - Adding type registration com.vividsolutions.jts.geom.GeometryCollection -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,211 DEBUG BasicTypeRegistry:148 - Adding type registration geometry -> org.hibernate.spatial.GeometryType@46c6cf3
20:03:50,384 INFO SchemaUpdate:182 - HHH000228: Running hbm2ddl schema update
20:03:50,384 INFO SchemaUpdate:193 - HHH000102: Fetching database metadata
20:03:50,387 INFO SchemaUpdate:205 - HHH000396: Updating schema
20:03:50,391 INFO DatabaseMetaData:120 - HHH000262: Table not found: EMPLOYEE
20:03:50,393 INFO DatabaseMetaData:120 - HHH000262: Table not found: MEETING
20:03:50,397 INFO DatabaseMetaData:120 - HHH000262: Table not found: SpatialTable
20:03:50,400 INFO DatabaseMetaData:120 - HHH000262: Table not found: employeemeeting
20:03:50,403 INFO DatabaseMetaData:120 - HHH000262: Table not found: EMPLOYEE
20:03:50,406 INFO DatabaseMetaData:120 - HHH000262: Table not found: MEETING
20:03:50,408 INFO DatabaseMetaData:120 - HHH000262: Table not found: SpatialTable
20:03:50,410 INFO DatabaseMetaData:120 - HHH000262: Table not found: employeemeeting
20:03:50,411 DEBUG SchemaUpdate:226 - create table EMPLOYEE (EMPLOYEE_ID bigserial not null, FIRSTNAME varchar(255), LASTNAME varchar(255), primary key (EMPLOYEE_ID))
20:03:50,538 DEBUG SchemaUpdate:226 - create table MEETING (MEETING_ID bigserial not null, MEETING_DATE timestamp, SUBJECT varchar(255), primary key (MEETING_ID))
20:03:50,606 DEBUG SchemaUpdate:226 - create table SpatialTable (id bigserial not null, point1 geography(POINT, 4326), point2 geography(POINT, 4326), primary key (id))
20:03:50,773 DEBUG SchemaUpdate:226 - create table employeemeeting (id serial not null, status boolean not null, employee_EMPLOYEE_ID int8, meeting_MEETING_ID int8, primary key (id))
20:03:50,827 DEBUG SchemaUpdate:226 - alter table employeemeeting add constraint FKF02123CDD85E7E94 foreign key (employee_EMPLOYEE_ID) references EMPLOYEE
20:03:50,830 DEBUG SchemaUpdate:226 - alter table employeemeeting add constraint FKF02123CD3DF74753 foreign key (meeting_MEETING_ID) references MEETING
20:03:50,833 INFO SchemaUpdate:240 - HHH000232: Schema update complete
20:03:50,947 DEBUG SQL:104 - /* insert com.test.hibernate.spatial.SpatialTable */ insert into SpatialTable (point1, point2) values (?, ?)
Hibernate: /* insert com.test.hibernate.spatial.SpatialTable */ insert into SpatialTable (point1, point2) values (?, ?)
20:03:50,962 DEBUG SQL:104 - /* insert com.test.hibernate.Employee */ insert into EMPLOYEE (FIRSTNAME, LASTNAME) values (?, ?)
Hibernate: /* insert com.test.hibernate.Employee */ insert into EMPLOYEE (FIRSTNAME, LASTNAME) values (?, ?)
20:03:50,964 TRACE BasicBinder:83 - binding parameter [1] as [VARCHAR] - Srikanth
20:03:50,965 TRACE BasicBinder:83 - binding parameter [2] as [VARCHAR] - Dyapa
20:03:50,966 DEBUG SQL:104 - /* insert com.test.hibernate.Employee */ insert into EMPLOYEE (FIRSTNAME, LASTNAME) values (?, ?)
Hibernate: /* insert com.test.hibernate.Employee */ insert into EMPLOYEE (FIRSTNAME, LASTNAME) values (?, ?)
20:03:50,967 TRACE BasicBinder:83 - binding parameter [1] as [VARCHAR] - Larry
20:03:50,967 TRACE BasicBinder:83 - binding parameter [2] as [VARCHAR] - Page
20:03:50,968 DEBUG SQL:104 - /* insert com.test.hibernate.Meeting */ insert into MEETING (MEETING_DATE, SUBJECT) values (?, ?)
Hibernate: /* insert com.test.hibernate.Meeting */ insert into MEETING (MEETING_DATE, SUBJECT) values (?, ?)
20:03:50,971 TRACE BasicBinder:83 - binding parameter [1] as [TIMESTAMP] - Sat Aug 08 20:03:50 IST 2015
20:03:50,972 TRACE BasicBinder:83 - binding parameter [2] as [VARCHAR] - Weekly Status meeting
20:03:50,980 INFO DriverManagerConnectionProviderImpl:160 - HHH000030: Cleaning up connection pool [jdbc:postgresql://localhost:5432/postgistest]
答案 0 :(得分:0)
尝试添加此内容:
log4j.logger.org.hibernate.spatial =调试