java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK

Hibernate JIRA | Srikanth Rajkumar | 5 years ago
  1. 0

    When the attached source is executed, i am getting the below error. Hibernate is not able to map composite keys if the keys names are different. For more information, visit this topic https://forum.hibernate.org/viewtopic.php?f=1&t=1012396 2011-09-07 02:36:21,080 [INFO] [org.hibernate.cfg.annotations.Version] - <Hibernate Annotations 3.5.5-Final> 2011-09-07 02:36:21,111 [INFO] [org.hibernate.cfg.Environment] - <Hibernate 3.5.5-Final> 2011-09-07 02:36:21,111 [INFO] [org.hibernate.cfg.Environment] - <hibernate.properties not found> 2011-09-07 02:36:21,127 [INFO] [org.hibernate.cfg.Environment] - <Bytecode provider name : javassist> 2011-09-07 02:36:21,142 [INFO] [org.hibernate.cfg.Environment] - <using JDK 1.4 java.sql.Timestamp handling> 2011-09-07 02:36:21,486 [INFO] [org.hibernate.annotations.common.Version] - <Hibernate Commons Annotations 3.2.0.Final> 2011-09-07 02:36:21,502 [INFO] [org.hibernate.ejb.Version] - <Hibernate EntityManager 3.5.5-Final> 2011-09-07 02:36:21,939 [INFO] [org.hibernate.cfg.AnnotationBinder] - <Binding entity from annotated class: com.hibernate.examples.entities.Mamam1> 2011-09-07 02:36:22,002 [INFO] [org.hibernate.cfg.annotations.EntityBinder] - <Bind entity com.hibernate.examples.entities.Mamam1 on table MAMAM1> 2011-09-07 02:36:22,096 [INFO] [org.hibernate.cfg.AnnotationBinder] - <Binding entity from annotated class: com.hibernate.examples.entities.Vya6cpp> 2011-09-07 02:36:22,096 [INFO] [org.hibernate.cfg.annotations.EntityBinder] - <Bind entity com.hibernate.examples.entities.Vya6cpp on table VYA6CPP> 2011-09-07 02:36:22,111 [INFO] [org.hibernate.cfg.AnnotationConfiguration] - <Hibernate Validator not found: ignoring> 2011-09-07 02:36:22,142 [INFO] [org.hibernate.cfg.search.HibernateSearchEventListenerRegister] - <Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.> 2011-09-07 02:36:22,299 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override equals(): com.hibernate.examples.entities.Vya6cppPK> 2011-09-07 02:36:22,299 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override hashCode(): com.hibernate.examples.entities.Vya6cppPK> 2011-09-07 02:36:22,314 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override equals(): com.hibernate.examples.entities.Mamam1PK> 2011-09-07 02:36:22,314 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override hashCode(): com.hibernate.examples.entities.Mamam1PK> 2011-09-07 02:36:22,314 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <Using Hibernate built-in connection pool (not for production use!)> 2011-09-07 02:36:22,314 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <Hibernate connection pool size: 20> 2011-09-07 02:36:22,314 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <autocommit mode: true> 2011-09-07 02:36:22,346 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <using driver: org.apache.derby.jdbc.ClientDriver at URL: jdbc:derby://localhost:1527/sample;> 2011-09-07 02:36:22,346 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <connection properties: {user=sample, password=****, autocommit=true, release_mode=auto}> 2011-09-07 02:36:22,783 [INFO] [org.hibernate.cfg.SettingsFactory] - <RDBMS: Apache Derby, version: 10.3.1.4 - (561794)> 2011-09-07 02:36:22,783 [INFO] [org.hibernate.cfg.SettingsFactory] - <JDBC driver: Apache Derby Network Client JDBC Driver, version: 10.3.1.4 - (561794)> 2011-09-07 02:36:22,846 [INFO] [org.hibernate.dialect.Dialect] - <Using dialect: org.hibernate.dialect.DerbyDialect> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.transaction.TransactionFactoryFactory] - <Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.transaction.TransactionManagerLookupFactory] - <No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Automatic flush during beforeCompletion(): disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Automatic session close at end of transaction: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Scrollable result sets: enabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <JDBC3 getGeneratedKeys(): disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Connection release mode: auto> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Default batch fetch size: 1> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Generate SQL with comments: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Order SQL updates by primary key: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Order SQL inserts for batching: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.hql.ast.ASTQueryTranslatorFactory] - <Using ASTQueryTranslatorFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Query language substitutions: {}> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <JPA-QL strict compliance: enabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Second-level cache: enabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Query cache: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Optimize cache for minimal puts: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Structured second-level cache entries: disabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Echoing all SQL to stdout> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Statistics: disabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Deleted entity synthetic identifier rollback: disabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Default entity-mode: pojo> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Named query checking : enabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Check Nullability in Core (should be disabled when Bean Validation is on): enabled> 2011-09-07 02:36:23,111 [INFO] [org.hibernate.impl.SessionFactoryImpl] - <building session factory> 2011-09-07 02:36:23,346 [INFO] [org.hibernate.impl.SessionFactoryObjectFactory] - <Not binding factory to JNDI, no JNDI name configured> Hibernate: select mamam1x0_.M1VIN1 as M1_0_, mamam1x0_.M1VIN2 as M2_0_, mamam1x0_.M1SHPR as M3_0_ from MAMAM1 mamam1x0_ 2011-09-07 02:36:23,768 [ERROR] [com.hibernate.examples.main.Main] - <Exception> java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:247) at com.hibernate.examples.main.Main.method1(Main.java:44) at com.hibernate.examples.testcase.MappingTestCase.testMain(MappingTestCase.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:135) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1028) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:623) at org.hibernate.type.EntityType.resolve(EntityType.java:431) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:140) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898) at org.hibernate.loader.Loader.doQuery(Loader.java:773) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270) at org.hibernate.loader.Loader.doList(Loader.java:2449) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192) at org.hibernate.loader.Loader.list(Loader.java:2187) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241) ... 26 more

    Hibernate JIRA | 5 years ago | Srikanth Rajkumar
    java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK
  2. 0

    When the attached source is executed, i am getting the below error. Hibernate is not able to map composite keys if the keys names are different. For more information, visit this topic https://forum.hibernate.org/viewtopic.php?f=1&t=1012396 2011-09-07 02:36:21,080 [INFO] [org.hibernate.cfg.annotations.Version] - <Hibernate Annotations 3.5.5-Final> 2011-09-07 02:36:21,111 [INFO] [org.hibernate.cfg.Environment] - <Hibernate 3.5.5-Final> 2011-09-07 02:36:21,111 [INFO] [org.hibernate.cfg.Environment] - <hibernate.properties not found> 2011-09-07 02:36:21,127 [INFO] [org.hibernate.cfg.Environment] - <Bytecode provider name : javassist> 2011-09-07 02:36:21,142 [INFO] [org.hibernate.cfg.Environment] - <using JDK 1.4 java.sql.Timestamp handling> 2011-09-07 02:36:21,486 [INFO] [org.hibernate.annotations.common.Version] - <Hibernate Commons Annotations 3.2.0.Final> 2011-09-07 02:36:21,502 [INFO] [org.hibernate.ejb.Version] - <Hibernate EntityManager 3.5.5-Final> 2011-09-07 02:36:21,939 [INFO] [org.hibernate.cfg.AnnotationBinder] - <Binding entity from annotated class: com.hibernate.examples.entities.Mamam1> 2011-09-07 02:36:22,002 [INFO] [org.hibernate.cfg.annotations.EntityBinder] - <Bind entity com.hibernate.examples.entities.Mamam1 on table MAMAM1> 2011-09-07 02:36:22,096 [INFO] [org.hibernate.cfg.AnnotationBinder] - <Binding entity from annotated class: com.hibernate.examples.entities.Vya6cpp> 2011-09-07 02:36:22,096 [INFO] [org.hibernate.cfg.annotations.EntityBinder] - <Bind entity com.hibernate.examples.entities.Vya6cpp on table VYA6CPP> 2011-09-07 02:36:22,111 [INFO] [org.hibernate.cfg.AnnotationConfiguration] - <Hibernate Validator not found: ignoring> 2011-09-07 02:36:22,142 [INFO] [org.hibernate.cfg.search.HibernateSearchEventListenerRegister] - <Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.> 2011-09-07 02:36:22,299 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override equals(): com.hibernate.examples.entities.Vya6cppPK> 2011-09-07 02:36:22,299 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override hashCode(): com.hibernate.examples.entities.Vya6cppPK> 2011-09-07 02:36:22,314 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override equals(): com.hibernate.examples.entities.Mamam1PK> 2011-09-07 02:36:22,314 [WARN] [org.hibernate.mapping.RootClass] - <composite-id class does not override hashCode(): com.hibernate.examples.entities.Mamam1PK> 2011-09-07 02:36:22,314 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <Using Hibernate built-in connection pool (not for production use!)> 2011-09-07 02:36:22,314 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <Hibernate connection pool size: 20> 2011-09-07 02:36:22,314 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <autocommit mode: true> 2011-09-07 02:36:22,346 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <using driver: org.apache.derby.jdbc.ClientDriver at URL: jdbc:derby://localhost:1527/sample;> 2011-09-07 02:36:22,346 [INFO] [org.hibernate.connection.DriverManagerConnectionProvider] - <connection properties: {user=sample, password=****, autocommit=true, release_mode=auto}> 2011-09-07 02:36:22,783 [INFO] [org.hibernate.cfg.SettingsFactory] - <RDBMS: Apache Derby, version: 10.3.1.4 - (561794)> 2011-09-07 02:36:22,783 [INFO] [org.hibernate.cfg.SettingsFactory] - <JDBC driver: Apache Derby Network Client JDBC Driver, version: 10.3.1.4 - (561794)> 2011-09-07 02:36:22,846 [INFO] [org.hibernate.dialect.Dialect] - <Using dialect: org.hibernate.dialect.DerbyDialect> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.transaction.TransactionFactoryFactory] - <Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.transaction.TransactionManagerLookupFactory] - <No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Automatic flush during beforeCompletion(): disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Automatic session close at end of transaction: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Scrollable result sets: enabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <JDBC3 getGeneratedKeys(): disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Connection release mode: auto> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Default batch fetch size: 1> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Generate SQL with comments: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Order SQL updates by primary key: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Order SQL inserts for batching: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.hql.ast.ASTQueryTranslatorFactory] - <Using ASTQueryTranslatorFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Query language substitutions: {}> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <JPA-QL strict compliance: enabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Second-level cache: enabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Query cache: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Optimize cache for minimal puts: disabled> 2011-09-07 02:36:23,018 [INFO] [org.hibernate.cfg.SettingsFactory] - <Structured second-level cache entries: disabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Echoing all SQL to stdout> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Statistics: disabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Deleted entity synthetic identifier rollback: disabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Default entity-mode: pojo> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Named query checking : enabled> 2011-09-07 02:36:23,033 [INFO] [org.hibernate.cfg.SettingsFactory] - <Check Nullability in Core (should be disabled when Bean Validation is on): enabled> 2011-09-07 02:36:23,111 [INFO] [org.hibernate.impl.SessionFactoryImpl] - <building session factory> 2011-09-07 02:36:23,346 [INFO] [org.hibernate.impl.SessionFactoryObjectFactory] - <Not binding factory to JNDI, no JNDI name configured> Hibernate: select mamam1x0_.M1VIN1 as M1_0_, mamam1x0_.M1VIN2 as M2_0_, mamam1x0_.M1SHPR as M3_0_ from MAMAM1 mamam1x0_ 2011-09-07 02:36:23,768 [ERROR] [com.hibernate.examples.main.Main] - <Exception> java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:247) at com.hibernate.examples.main.Main.method1(Main.java:44) at com.hibernate.examples.testcase.MappingTestCase.testMain(MappingTestCase.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:135) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1028) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:623) at org.hibernate.type.EntityType.resolve(EntityType.java:431) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:140) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898) at org.hibernate.loader.Loader.doQuery(Loader.java:773) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270) at org.hibernate.loader.Loader.doList(Loader.java:2449) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192) at org.hibernate.loader.Loader.list(Loader.java:2187) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241) ... 26 more

    Hibernate JIRA | 5 years ago | Srikanth Rajkumar
    java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK
  3. 0

    org.hibernate.TypeMismatchException: Provided id of the wrong type

    Stack Overflow | 5 years ago | Andrea
    org.hibernate.TypeMismatchException: Provided id of the wrong type for class delidete.domain.Datigeneralipareretecnico. Expected: class delidete.domain.DatigeneralipareretecnicoPK, got class delidete.domain.DatigeneralivistocontabilePK
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.hibernate.TypeMismatchException: id of the wrong type - Genuitec

    genuitec.com | 4 months ago
    org.hibernate.TypeMismatchException: Provided id of the wrong type for class delidete.domain.Datigeneralipareretecnico. Expected: class delidete.domain.DatigeneralipareretecnicoPK, got class delidete.domain.DatigeneralivistocontabilePK
  6. 0

    Hibernate Community • View topic - Provided id of the wrong type. Expected: Long got Integer

    hibernate.org | 5 months ago
    org.springframework.orm.hibernate3.HibernateSystemException: Provided id of the wrong type. Expected: class java.lang.Long, got class java.lang.Integer; nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Long, got class java.lang.Integer

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.TypeMismatchException

      Provided id of the wrong type for class com.hibernate.examples.entities.Vya6cpp. Expected: class com.hibernate.examples.entities.Vya6cppPK, got class com.hibernate.examples.entities.Mamam1PK

      at org.hibernate.event.def.DefaultLoadEventListener.onLoad()
    2. Hibernate
      SessionImpl.internalLoad
      1. org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:135)
      2. org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
      3. org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1028)
      3 frames
    3. Hibernate
      QueryLoader.list
      1. org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:623)
      2. org.hibernate.type.EntityType.resolve(EntityType.java:431)
      3. org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:140)
      4. org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898)
      5. org.hibernate.loader.Loader.doQuery(Loader.java:773)
      6. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
      7. org.hibernate.loader.Loader.doList(Loader.java:2449)
      8. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192)
      9. org.hibernate.loader.Loader.list(Loader.java:2187)
      10. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
      10 frames
    4. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.list
      1. org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
      1 frame
    5. Hibernate
      QueryImpl.list
      1. org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
      2. org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
      3. org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
      3 frames
    6. Hibernate EJB
      QueryImpl.getResultList
      1. org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241)
      1 frame
    7. com.hibernate.examples
      MappingTestCase.testMain
      1. com.hibernate.examples.main.Main.method1(Main.java:44)
      2. com.hibernate.examples.testcase.MappingTestCase.testMain(MappingTestCase.java:26)
      2 frames
    8. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    9. JUnit
      ParentRunner.run
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      5. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      6. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
      8. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
      9. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
      10. org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
      11. org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
      12. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      13. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      14. org.junit.runners.ParentRunner.run(ParentRunner.java:220)
      14 frames
    10. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
      1 frame
    11. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      5 frames