[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-7165) ount query on classes mapped as EmbeddedId with multiple Id's fail to execute
Ståle W. Pedersen (JIRA)
noreply at atlassian.com
Mon Mar 12 10:33:48 EDT 2012
[ https://hibernate.onjira.com/browse/HHH-7165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45913#comment-45913 ]
Ståle W. Pedersen commented on HHH-7165:
----------------------------------------
15:23:38,778 INFO Version:41 - HHH000412: Hibernate Core {[WORKING]}
15:23:38,784 INFO Environment:224 - HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.h2.Driver, hibernate.dialect=org.hibernate.dialect.H2Dialect, hibernate.max_fetch_depth=5, hibernate.cache.region.factory_class=org.hibernate.testing.cache.CachingRegionFactory, hibernate.connection.username=sa, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=false, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=5}
15:23:38,786 INFO Environment:342 - HHH000021: Bytecode provider name : javassist
15:23:38,795 INFO Dialect:122 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
15:23:38,880 INFO Dialect:122 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
15:23:38,907 INFO Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
15:23:39,085 INFO DriverManagerConnectionProviderImpl:90 - HHH000402: Using Hibernate built-in connection pool (not for production use!)
15:23:39,088 INFO DriverManagerConnectionProviderImpl:110 - HHH000115: Hibernate connection pool size: 5
15:23:39,089 INFO DriverManagerConnectionProviderImpl:113 - HHH000006: Autocommit mode: false
15:23:39,089 INFO DriverManagerConnectionProviderImpl:127 - HHH000401: using driver [org.h2.Driver] at URL [jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE]
15:23:39,089 INFO DriverManagerConnectionProviderImpl:132 - HHH000046: Connection properties: {user=sa}
15:23:39,214 INFO Dialect:122 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
15:23:39,216 INFO LobCreatorBuilder:94 - HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
15:23:39,222 INFO TransactionFactoryInitiator:68 - HHH000399: Using default transaction strategy (direct JDBC transactions)
15:23:39,225 INFO ASTQueryTranslatorFactory:48 - HHH000397: Using ASTQueryTranslatorFactory
15:23:39,226 WARN CachingRegionFactory:57 - CachingRegionFactory should be only used for testing.
15:23:39,256 INFO Version:24 - Hibernate Validator 4.2.0.Final
15:23:39,431 INFO SchemaExport:344 - HHH000227: Running hbm2ddl schema export
15:23:39,432 DEBUG SchemaExport:354 - Import file not found: /import.sql
15:23:39,433 DEBUG SQL:104 - alter table S_PURCH_ORDERLINE drop constraint FK6F3F0449EF1D2E20
15:23:39,437 ERROR SchemaExport:426 - HHH000389: Unsuccessful: alter table S_PURCH_ORDERLINE drop constraint FK6F3F0449EF1D2E20
15:23:39,437 ERROR SchemaExport:427 - Table "S_PURCH_ORDERLINE" not found; SQL statement:
alter table S_PURCH_ORDERLINE drop constraint FK6F3F0449EF1D2E20 [42102-145]
15:23:39,437 DEBUG SQL:104 - drop table S_PURCH_ORDER if exists
15:23:39,438 DEBUG SQL:104 - drop table S_PURCH_ORDERLINE if exists
15:23:39,438 DEBUG SQL:104 - drop table U_SEQUENCES if exists
15:23:39,438 DEBUG SQL:104 - create table S_PURCH_ORDER (PO_NUMBER integer not null, PO_SITE_ID integer not null, PO_POPULAR_SUPP integer, PO_SENT_DATE date, PO_START_DATE timestamp, PO_VERSION integer, primary key (PO_NUMBER, PO_SITE_ID))
15:23:39,442 DEBUG SQL:104 - create table S_PURCH_ORDERLINE (POL_NUMBER integer not null, POL_LOCATION integer not null, POL_PO_ID integer not null, POL_BALANCE decimal(19,2), POL_P_ID varchar(255), POL_DELDATE date, POL_LEADTIME integer, POL_MESSAGE varchar(255), POL_QTY integer, POL_VERSION integer, primary key (POL_NUMBER, POL_LOCATION, POL_PO_ID))
15:23:39,443 DEBUG SQL:104 - alter table S_PURCH_ORDERLINE add constraint FK6F3F0449EF1D2E20 foreign key (POL_PO_ID, POL_LOCATION) references S_PURCH_ORDER
15:23:39,449 DEBUG SQL:104 - create table U_SEQUENCES ( S_ID varchar(255) not null , S_NEXTNUM bigint, primary key ( S_ID ) )
15:23:39,450 INFO SchemaExport:406 - HHH000230: Schema export complete
15:23:39,554 DEBUG SQL:104 - select count((purchaseor0_.POL_NUMBER, purchaseor0_.POL_LOCATION, purchaseor0_.POL_PO_ID)) as col_0_0_ from S_PURCH_ORDERLINE purchaseor0_
15:23:39,586 DEBUG SQL:104 - select count(purchaseor0_.PO_NUMBER) as col_0_0_ from S_PURCH_ORDER purchaseor0_
15:23:39,717 INFO SchemaExport:344 - HHH000227: Running hbm2ddl schema export
15:23:39,718 DEBUG SchemaExport:354 - Import file not found: /import.sql
15:23:39,718 DEBUG SQL:104 - alter table S_PURCH_ORDERLINE drop constraint FK6F3F0449EF1D2E20
15:23:39,719 DEBUG SQL:104 - drop table S_PURCH_ORDER if exists
15:23:39,720 DEBUG SQL:104 - drop table S_PURCH_ORDERLINE if exists
15:23:39,720 DEBUG SQL:104 - drop table U_SEQUENCES if exists
15:23:39,721 INFO SchemaExport:406 - HHH000230: Schema export complete
15:23:39,721 INFO DriverManagerConnectionProviderImpl:136 - HHH000030: Cleaning up connection pool [jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE]
> ount query on classes mapped as EmbeddedId with multiple Id's fail to execute
> -----------------------------------------------------------------------------
>
> Key: HHH-7165
> URL: https://hibernate.onjira.com/browse/HHH-7165
> Project: Hibernate ORM
> Issue Type: Bug
> Components: core
> Affects Versions: 4.1.1
> Reporter: Ståle W. Pedersen
>
> When doing a count on a class mapped as EmbeddedId with multiple Id's the generated sql will fail on several db's (tested on MySQL/MariaDB) since hibernate generate a count sql containing all the id's.
> Hibernate creates a different (correct) sql on classes mapped with IdClass and multiple Id's.
> A simple test that verify the difference between the two:
> https://github.com/stalep/hibernate-orm/commit/54911765de7981ec9a2318fc9928be68ff37bab3
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list