-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: HQL query on @ManyToMany query applied to Map
PostPosted: Thu Jun 23, 2011 5:45 am 
Newbie

Joined: Thu May 05, 2011 6:33 am
Posts: 16
That are my entity, unchangable, because I introduce hibernate in refactoring.

DocumentPackage is related ManyToMany to DocumentType, the relationship on typeList property, managed an Map.

My problem is: I want the DocumentPackage with the following where condition:

documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN

All works well until I introduce a condition on typeList.

I want only the DocumentPackage where DocumentType key name attribute is :DOCUMENTNAME.

This is the SQL query

select * from V_DCM_PACKAGE vdp inner join V_DCM_PACKAGE_TYPE dpt on VDp.E_SOTTAPP_K_SOTTO_APPLICAZIONE =
dpt.dp_k_sotto_applicazione AND dpt.e_tpdocaz_k_tipo_doc_aziendale = vdp.k_tipo_doc_aziendale right join V_DCM_TYPE dt on
dpt.k_documento_aziendale = dt.k_documento_aziendale AND dpt.k_sotto_applicazione = dt.k_sotto_applicazione where
dt.K_SOTTO_APPLICAZIONE = 'PFM' and dt.K_DOCUMENTO_AZIENDALE = 'ESTAN00001_000' and vdp.k_tipo_doc_aziendale = 'BASE' and
vdp.e_sottapp_k_sotto_applicazione = 'PFM'


So i try the following HQL but I have always error...

Code:
sb.append(" from DocumentPackage ");
sb.append(" ");
sb.append(" where documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN ");
sb.append(" and ");
sb.append(" index[typeList].documentTypeKey.name = :DOCUMENTNAME ");


11:21:53.152 [main] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 13088209130
11:21:58.891 [main] DEBUG o.s.o.hibernate3.SessionFactoryUtils - Opening Hibernate Session
11:21:58.892 [main] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 13088209188
11:21:59.065 [main] DEBUG o.h.hql.ast.QueryTranslatorImpl - parse() - HQL: from it.nacon.gedi.typeregistry.domain.DocumentPackage where documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN and index[typeList].documentTypeKey.name = :DOCUMENTNAME
11:21:59.137 [main] DEBUG org.hibernate.hql.ast.AST - --- HQL AST ---
\-[QUERY] Node: 'query'
+-[SELECT_FROM] Node: 'SELECT_FROM'
| \-[FROM] Node: 'from'
| \-[RANGE] Node: 'RANGE'
| \-[DOT] Node: '.'
| +-[DOT] Node: '.'
| | +-[DOT] Node: '.'
| | | +-[DOT] Node: '.'
| | | | +-[DOT] Node: '.'
| | | | | +-[IDENT] Node: 'it'
| | | | | \-[IDENT] Node: 'nacon'
| | | | \-[IDENT] Node: 'gedi'
| | | \-[IDENT] Node: 'typeregistry'
| | \-[IDENT] Node: 'domain'
| \-[IDENT] Node: 'DocumentPackage'
\-[WHERE] Node: 'where'
\-[AND] Node: 'and'
+-[AND] Node: 'and'
| +-[EQ] Node: '='
| | +-[DOT] Node: '.'
| | | +-[IDENT] Node: 'documentPackageKey'
| | | \-[IDENT] Node: 'name'
| | \-[COLON] Node: ':'
| | \-[IDENT] Node: 'PACKAGENAME'
| \-[EQ] Node: '='
| +-[DOT] Node: '.'
| | +-[IDENT] Node: 'documentPackageKey'
| | \-[IDENT] Node: 'applicationDomainEnum'
| \-[COLON] Node: ':'
| \-[IDENT] Node: 'DOMAIN'
\-[EQ] Node: '='
+-[DOT] Node: '.'
| +-[DOT] Node: '.'
| | +-[INDEX_OP] Node: '['
| | | +-[IDENT] Node: 'index'
| | | \-[IDENT] Node: 'typeList'
| | \-[IDENT] Node: 'documentTypeKey'
| \-[IDENT] Node: 'name'
\-[COLON] Node: ':'
\-[IDENT] Node: 'DOCUMENTNAME'

11:21:59.137 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
11:21:59.261 [main] DEBUG o.h.hql.antlr.HqlSqlBaseWalker - select << begin [level=1, statement=select]
11:21:59.316 [main] DEBUG o.hibernate.hql.ast.tree.FromElement - FromClause{level=1} : it.nacon.gedi.typeregistry.domain.DocumentPackage (no alias) -> documentpa0_
11:21:59.329 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias} -> {synthetic-alias}
11:21:59.335 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey -> org.hibernate.type.ComponentType@13206fd
11:21:59.336 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - Unresolved property path is now 'documentPackageKey.name'
11:21:59.337 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey -> documentpa0_.K_TIPO_DOC_AZIENDALE
11:21:59.337 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey.name -> org.hibernate.type.StringType@161c9d1
11:21:59.340 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey.name -> documentpa0_.K_TIPO_DOC_AZIENDALE
11:21:59.354 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias} -> {synthetic-alias}
11:21:59.354 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey -> org.hibernate.type.ComponentType@13206fd
11:21:59.355 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - Unresolved property path is now 'documentPackageKey.applicationDomainEnum'
11:21:59.355 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey -> documentpa0_.E_SOTTAPP_K_SOTTO_APPLICAZIONE
11:21:59.356 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey.applicationDomainEnum -> org.hibernate.type.StringType@161c9d1
11:21:59.356 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey.applicationDomainEnum -> documentpa0_.E_SOTTAPP_K_SOTTO_APPLICAZIONE
11:21:59.366 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias} -> {synthetic-alias}
11:21:59.367 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : typeList -> org.hibernate.type.MapType(it.nacon.gedi.typeregistry.domain.DocumentPackage.typeList)
11:21:59.370 [main] DEBUG o.h.hql.ast.tree.FromElementFactory - createManyToMany() : path = {synthetic-alias}.typeList role = it.nacon.gedi.typeregistry.domain.DocumentPackage.typeList associatedEntityName = it.nacon.gedi.typeregistry.domain.DocumentType
11:21:59.379 [main] DEBUG o.hibernate.hql.ast.tree.FromElement - FromClause{level=1} : it.nacon.gedi.typeregistry.domain.DocumentType (no alias) -> documentty2_
11:21:59.380 [main] DEBUG o.hibernate.hql.ast.tree.FromClause - addJoinByPathMap() : {synthetic-alias}.typeList -> ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=V_DCM_TYPE,tableAlias=documentty2_,origin=V_DCM_PACKAGE documentpa0_,columns={documentpa0_.E_SOTTAPP_K_SOTTO_APPLICAZIONE documentpa0_.K_TIPO_DOC_AZIENDALE ,className=it.nacon.gedi.typeregistry.domain.DocumentType}}
11:21:59.381 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - dereferenceCollection() : Created new FROM element for {synthetic-alias}.typeList : V_DCM_PACKAGE_TYPE documentty2_
11:21:59.382 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.typeList -> {non-qualified-property-ref}
11:22:01.199 [main] DEBUG o.s.t.c.s.DirtiesContextTestExecutionListener - After test method: context [[TestContext@1758500 testClass = CoreTypeRegistryDaoTest, locations = array<String>['classpath:/it/nacon/gedi/service/typeregistry/dao/CoreTypeRegistryDaoTest-context.xml'], testInstance = it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest@6ed322, testMethod = testDocumentInPackage@CoreTypeRegistryDaoTest, testException = java.lang.UnsupportedOperationException]], class dirties context [false], class mode [null], method dirties context [false].
11:22:01.209 [main] DEBUG o.s.t.c.s.DirtiesContextTestExecutionListener - After test class: context [[TestContext@1758500 testClass = CoreTypeRegistryDaoTest, locations = array<String>['classpath:/it/nacon/gedi/service/typeregistry/dao/CoreTypeRegistryDaoTest-context.xml'], testInstance = [null], testMethod = [null], testException = [null]]], dirtiesContext [false].
11:22:01.215 [Thread-1] INFO o.s.c.s.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@988707: startup date [Thu Jun 23 11:21:44 CEST 2011]; root of context hierarchy
11:22:01.216 [Thread-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
11:22:01.216 [Thread-1] INFO o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@19480b8: defining beans [sessionFactoryTypeRegistry,dataSourceTypeRegistry,documentClassDao,documentPackageDao,documentTypeDao,coreTypeRegistryDao,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor]; root of factory hierarchy
11:22:01.216 [Thread-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean 'coreTypeRegistryDao': [it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest]
11:22:01.228 [Thread-1] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'sessionFactoryTypeRegistry'
11:22:01.228 [Thread-1] INFO o.s.o.h.a.AnnotationSessionFactoryBean - Closing Hibernate SessionFactory



Code:
sb.append(" from DocumentPackage ");
      sb.append(" inner join fetch typeList list");

      sb.append(" where documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN ");
      sb.append(" and ");
      sb.append(" index(list.documentTypeKey.name) = :DOCUMENTNAME ");



11:39:18.664 [main] DEBUG org.hibernate.hql.ast.AST - --- HQL AST ---
\-[QUERY] Node: 'query'
+-[SELECT_FROM] Node: 'SELECT_FROM'
| \-[FROM] Node: 'from'
| +-[RANGE] Node: 'RANGE'
| | \-[DOT] Node: '.'
| | +-[DOT] Node: '.'
| | | +-[DOT] Node: '.'
| | | | +-[DOT] Node: '.'
| | | | | +-[DOT] Node: '.'
| | | | | | +-[IDENT] Node: 'it'
| | | | | | \-[IDENT] Node: 'nacon'
| | | | | \-[IDENT] Node: 'gedi'
| | | | \-[IDENT] Node: 'typeregistry'
| | | \-[IDENT] Node: 'domain'
| | \-[IDENT] Node: 'DocumentPackage'
| \-[JOIN] Node: 'join'
| +-[INNER] Node: 'inner'
| +-[FETCH] Node: 'fetch'
| +-[IDENT] Node: 'typeList'
| \-[ALIAS] Node: 'list'
\-[WHERE] Node: 'where'
\-[AND] Node: 'and'
+-[AND] Node: 'and'
| +-[EQ] Node: '='
| | +-[DOT] Node: '.'
| | | +-[IDENT] Node: 'documentPackageKey'
| | | \-[IDENT] Node: 'name'
| | \-[COLON] Node: ':'
| | \-[IDENT] Node: 'PACKAGENAME'
| \-[EQ] Node: '='
| +-[DOT] Node: '.'
| | +-[IDENT] Node: 'documentPackageKey'
| | \-[IDENT] Node: 'applicationDomainEnum'
| \-[COLON] Node: ':'
| \-[IDENT] Node: 'DOMAIN'
\-[EQ] Node: '='
+-[METHOD_CALL] Node: '('
| +-[IDENT] Node: 'index'
| \-[EXPR_LIST] Node: 'exprList'
| \-[DOT] Node: '.'
| +-[DOT] Node: '.'
| | +-[IDENT] Node: 'list'
| | \-[IDENT] Node: 'documentTypeKey'
| \-[IDENT] Node: 'name'
\-[COLON] Node: ':'
\-[IDENT] Node: 'DOCUMENTNAME'

11:39:18.664 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
11:39:18.732 [main] DEBUG o.h.hql.antlr.HqlSqlBaseWalker - select << begin [level=1, statement=select]
11:39:18.760 [main] DEBUG o.hibernate.hql.ast.tree.FromElement - FromClause{level=1} : it.nacon.gedi.typeregistry.domain.DocumentPackage (no alias) -> documentpa0_
11:39:18.768 [main] ERROR org.hibernate.hql.PARSER - Path expected for join!
11:39:18.780 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - Path expected for join!
antlr.SemanticException: Path expected for join!
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:372) ~[hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3671) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3452) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at it.nacon.gedi.service.typeregistry.dao.DocumentPackageDao.isDocumentInPackage(DocumentPackageDao.java:81) [classes/:na]
at it.nacon.gedi.service.typeregistry.impl.CoreTypeRegistryDaoImpl.isDocumentInPackage_aroundBody4(CoreTypeRegistryDaoImpl.java:103) [classes/:na]
at it.nacon.gedi.service.typeregistry.impl.CoreTypeRegistryDaoImpl.isDocumentInPackage_aroundBody5$advice(CoreTypeRegistryDaoImpl.java:92) [classes/:na]
at it.nacon.gedi.service.typeregistry.impl.CoreTypeRegistryDaoImpl.isDocumentInPackage(CoreTypeRegistryDaoImpl.java:1) [classes/:na]
at it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest.testDocumentInPackage(CoreTypeRegistryDaoTest.java:43) [test-classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_21]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_21]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit-4.8.2.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.8.2.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit-4.8.2.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-4.8.2.jar:na]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) [junit-4.8.2.jar:na]
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit-4.8.2.jar:na]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit-4.8.2.jar:na]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
11:39:18.785 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias} -> {synthetic-alias}
11:39:18.789 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey -> org.hibernate.type.ComponentType@150fcc7
11:39:18.789 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - Unresolved property path is now 'documentPackageKey.name'
11:39:18.790 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey -> documentpa0_.K_TIPO_DOC_AZIENDALE
11:39:18.790 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey.name -> org.hibernate.type.StringType@3f58bb
11:39:18.791 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey.name -> documentpa0_.K_TIPO_DOC_AZIENDALE
11:39:18.797 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias} -> {synthetic-alias}
11:39:18.797 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey -> org.hibernate.type.ComponentType@150fcc7
11:39:18.798 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - Unresolved property path is now 'documentPackageKey.applicationDomainEnum'
11:39:18.798 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey -> documentpa0_.E_SOTTAPP_K_SOTTO_APPLICAZIONE
11:39:18.799 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey.applicationDomainEnum -> org.hibernate.type.StringType@3f58bb
11:39:18.799 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey.applicationDomainEnum -> documentpa0_.E_SOTTAPP_K_SOTTO_APPLICAZIONE
11:39:18.806 [main] DEBUG o.s.t.c.s.DirtiesContextTestExecutionListener - After test method: context [[TestContext@6ed322 testClass = CoreTypeRegistryDaoTest, locations = array<String>['classpath:/it/nacon/gedi/service/typeregistry/dao/CoreTypeRegistryDaoTest-context.xml'], testInstance = it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest@1e78c96, testMethod = testDocumentInPackage@CoreTypeRegistryDaoTest, testException = org.hibernate.QueryException: Unable to resolve path [list.documentTypeKey], unexpected token [list] [ from it.nacon.gedi.typeregistry.domain.DocumentPackage inner join fetch typeList list where documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN and index(list.documentTypeKey.name) = :DOCUMENTNAME ]]], class dirties context [false], class mode [null], method dirties context [false].
11:39:18.814 [main] DEBUG o.s.t.c.s.DirtiesContextTestExecutionListener - After test class: context [[TestContext@6ed322 testClass = CoreTypeRegistryDaoTest, locations = array<String>['classpath:/it/nacon/gedi/service/typeregistry/dao/CoreTypeRegistryDaoTest-context.xml'], testInstance = [null], testMethod = [null], testException = [null]]], dirtiesContext [false].
11:39:18.819 [Thread-1] INFO o.s.c.s.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@1c8ef56: startup date [Thu Jun 23 11:39:07 CEST 2011]; root of context hierarchy
11:39:18.820 [Thread-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
11:39:18.820 [Thread-1] INFO o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1b7edd3: defining beans [sessionFactoryTypeRegistry,dataSourceTypeRegistry,documentClassDao,documentPackageDao,documentTypeDao,coreTypeRegistryDao,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor]; root of factory hierarchy
11:39:18.821 [Thread-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean 'coreTypeRegistryDao': [it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest]
11:39:18.830 [Thread-1] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'sessionFactoryTypeRegistry'
11:39:18.830 [Thread-1] INFO o.s.o.h.a.AnnotationSessionFactoryBean - Closing Hibernate SessionFactory
11:39:18.831 [Thread-1] INFO o.hibernate.impl.SessionFactoryImpl - closing
11:39:18.835 [Thread-1] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy method 'close' on bean with name 'dataSourceTypeRegistry'

Code:
   
      sb.append(" from DocumentPackage ");
      sb.append(" inner join fetch typeList list");

      sb.append(" where documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN ");
      sb.append(" and ");
      sb.append(" list.documentTypeKey.name = :DOCUMENTNAME ");      
   
   


11:41:46.521 [main] DEBUG o.s.o.hibernate3.SessionFactoryUtils - Opening Hibernate Session
11:41:46.521 [main] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 13088221065
11:41:46.693 [main] DEBUG o.h.hql.ast.QueryTranslatorImpl - parse() - HQL: from it.nacon.gedi.typeregistry.domain.DocumentPackage inner join fetch typeList list where documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN and list.documentTypeKey.name = :DOCUMENTNAME
11:41:46.768 [main] DEBUG org.hibernate.hql.ast.AST - --- HQL AST ---
\-[QUERY] Node: 'query'
+-[SELECT_FROM] Node: 'SELECT_FROM'
| \-[FROM] Node: 'from'
| +-[RANGE] Node: 'RANGE'
| | \-[DOT] Node: '.'
| | +-[DOT] Node: '.'
| | | +-[DOT] Node: '.'
| | | | +-[DOT] Node: '.'
| | | | | +-[DOT] Node: '.'
| | | | | | +-[IDENT] Node: 'it'
| | | | | | \-[IDENT] Node: 'nacon'
| | | | | \-[IDENT] Node: 'gedi'
| | | | \-[IDENT] Node: 'typeregistry'
| | | \-[IDENT] Node: 'domain'
| | \-[IDENT] Node: 'DocumentPackage'
| \-[JOIN] Node: 'join'
| +-[INNER] Node: 'inner'
| +-[FETCH] Node: 'fetch'
| +-[IDENT] Node: 'typeList'
| \-[ALIAS] Node: 'list'
\-[WHERE] Node: 'where'
\-[AND] Node: 'and'
+-[AND] Node: 'and'
| +-[EQ] Node: '='
| | +-[DOT] Node: '.'
| | | +-[IDENT] Node: 'documentPackageKey'
| | | \-[IDENT] Node: 'name'
| | \-[COLON] Node: ':'
| | \-[IDENT] Node: 'PACKAGENAME'
| \-[EQ] Node: '='
| +-[DOT] Node: '.'
| | +-[IDENT] Node: 'documentPackageKey'
| | \-[IDENT] Node: 'applicationDomainEnum'
| \-[COLON] Node: ':'
| \-[IDENT] Node: 'DOMAIN'
\-[EQ] Node: '='
+-[DOT] Node: '.'
| +-[DOT] Node: '.'
| | +-[IDENT] Node: 'list'
| | \-[IDENT] Node: 'documentTypeKey'
| \-[IDENT] Node: 'name'
\-[COLON] Node: ':'
\-[IDENT] Node: 'DOCUMENTNAME'

11:41:46.768 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
11:41:46.889 [main] DEBUG o.h.hql.antlr.HqlSqlBaseWalker - select << begin [level=1, statement=select]
11:41:46.944 [main] DEBUG o.hibernate.hql.ast.tree.FromElement - FromClause{level=1} : it.nacon.gedi.typeregistry.domain.DocumentPackage (no alias) -> documentpa0_
11:41:46.965 [main] ERROR org.hibernate.hql.PARSER - Path expected for join!
11:41:46.993 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - Path expected for join!
antlr.SemanticException: Path expected for join!
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:372) ~[hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3671) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3452) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) [hibernate-core-3.6.3.Final.jar:3.6.3.Final]
at it.nacon.gedi.service.typeregistry.dao.DocumentPackageDao.isDocumentInPackage(DocumentPackageDao.java:81) [classes/:na]
at it.nacon.gedi.service.typeregistry.impl.CoreTypeRegistryDaoImpl.isDocumentInPackage_aroundBody4(CoreTypeRegistryDaoImpl.java:103) [classes/:na]
at it.nacon.gedi.service.typeregistry.impl.CoreTypeRegistryDaoImpl.isDocumentInPackage_aroundBody5$advice(CoreTypeRegistryDaoImpl.java:92) [classes/:na]
at it.nacon.gedi.service.typeregistry.impl.CoreTypeRegistryDaoImpl.isDocumentInPackage(CoreTypeRegistryDaoImpl.java:1) [classes/:na]
at it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest.testDocumentInPackage(CoreTypeRegistryDaoTest.java:43) [test-classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_21]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_21]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit-4.8.2.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.8.2.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit-4.8.2.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-4.8.2.jar:na]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) [junit-4.8.2.jar:na]
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit-4.8.2.jar:na]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit-4.8.2.jar:na]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) [spring-test-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
11:41:47.007 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias} -> {synthetic-alias}
11:41:47.013 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey -> org.hibernate.type.ComponentType@8c822d
11:41:47.013 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - Unresolved property path is now 'documentPackageKey.name'
11:41:47.014 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey -> documentpa0_.K_TIPO_DOC_AZIENDALE
11:41:47.014 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey.name -> org.hibernate.type.StringType@1cc5312
11:41:47.018 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey.name -> documentpa0_.K_TIPO_DOC_AZIENDALE
11:41:47.034 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias} -> {synthetic-alias}
11:41:47.034 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey -> org.hibernate.type.ComponentType@8c822d
11:41:47.035 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - Unresolved property path is now 'documentPackageKey.applicationDomainEnum'
11:41:47.036 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey -> documentpa0_.E_SOTTAPP_K_SOTTO_APPLICAZIONE
11:41:47.036 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : documentPackageKey.applicationDomainEnum -> org.hibernate.type.StringType@1cc5312
11:41:47.042 [main] DEBUG o.h.hql.ast.tree.FromReferenceNode - Resolved : {synthetic-alias}.documentPackageKey.applicationDomainEnum -> documentpa0_.E_SOTTAPP_K_SOTTO_APPLICAZIONE
11:41:50.501 [main] DEBUG o.s.t.c.s.DirtiesContextTestExecutionListener - After test method: context [[TestContext@1e67e6a testClass = CoreTypeRegistryDaoTest, locations = array<String>['classpath:/it/nacon/gedi/service/typeregistry/dao/CoreTypeRegistryDaoTest-context.xml'], testInstance = it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest@1758500, testMethod = testDocumentInPackage@CoreTypeRegistryDaoTest, testException = org.hibernate.QueryException: Unable to resolve path [list.documentTypeKey], unexpected token [list] [ from it.nacon.gedi.typeregistry.domain.DocumentPackage inner join fetch typeList list where documentPackageKey.name = :PACKAGENAME and documentPackageKey.applicationDomainEnum = :DOMAIN and list.documentTypeKey.name = :DOCUMENTNAME ]]], class dirties context [false], class mode [null], method dirties context [false].
11:41:50.510 [main] DEBUG o.s.t.c.s.DirtiesContextTestExecutionListener - After test class: context [[TestContext@1e67e6a testClass = CoreTypeRegistryDaoTest, locations = array<String>['classpath:/it/nacon/gedi/service/typeregistry/dao/CoreTypeRegistryDaoTest-context.xml'], testInstance = [null], testMethod = [null], testException = [null]]], dirtiesContext [false].
11:41:50.515 [Thread-1] INFO o.s.c.s.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@1552b76: startup date [Thu Jun 23 11:41:34 CEST 2011]; root of context hierarchy
11:41:50.516 [Thread-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
11:41:50.516 [Thread-1] INFO o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@bf1f20: defining beans [sessionFactoryTypeRegistry,dataSourceTypeRegistry,documentClassDao,documentPackageDao,documentTypeDao,coreTypeRegistryDao,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor]; root of factory hierarchy
11:41:50.522 [Thread-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean 'coreTypeRegistryDao': [it.nacon.gedi.service.typeregistry.dao.CoreTypeRegistryDaoTest]
11:41:50.530 [Thread-1] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'sessionFactoryTypeRegistry'
11:41:50.531 [Thread-1] INFO o.s.o.h.a.AnnotationSessionFactoryBean - Closing Hibernate SessionFactory
11:41:50.532 [Thread-1] INFO o.hibernate.impl.SessionFactoryImpl - closing
11:41:50.534 [Thread-1] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy method 'close' on bean with name 'dataSourceTypeRegistry'



Code:
@Entity
@Table(name = "V_DCM_PACKAGE")
public class DocumentPackage implements Serializable {

   private static final long serialVersionUID = -6421384252587935522L;

   @EmbeddedId
   private DocumentPackageKey documentPackageKey = new DocumentPackageKey();

   @Column(name = "N_TIPO_DOC_AZIENDALE")
   private String description;

   @Transient
   private List<String> references = new ArrayList<String>();

   @ManyToMany
   @MapKey(name = "documentTypeKey.name")
   @JoinTable(name = "V_DCM_PACKAGE_TYPE", joinColumns = {
         @JoinColumn(name = "K_SOTTO_APPLICAZIONE", referencedColumnName = "E_SOTTAPP_K_SOTTO_APPLICAZIONE"),
         @JoinColumn(name = "E_TPDOCAZ_K_TIPO_DOC_AZIENDALE", referencedColumnName = "K_TIPO_DOC_AZIENDALE") }, inverseJoinColumns = {
         @JoinColumn(name = "K_DOCUMENTO_AZIENDALE", referencedColumnName = "K_DOCUMENTO_AZIENDALE"),
         @JoinColumn(name = "DP_K_SOTTO_APPLICAZIONE", referencedColumnName = "K_SOTTO_APPLICAZIONE") })
   private Map<String, DocumentType> typeList = new TreeMap<String, DocumentType>();

   @Transient
   public String getName() {
      return documentPackageKey.getName();
   }

   public void setName(final String name) {
      this.documentPackageKey.setName(name);
   }

   @Transient
   public String getApplicationDomainEnum() {
      return this.documentPackageKey.getApplicationDomainEnum();
   }

   public void setApplicationDomainEnum(String applicationDomainEnum) {
      this.documentPackageKey.setApplicationDomainEnum(applicationDomainEnum);
   }

   public DocumentPackageKey getDocumentPackageKey() {
      return documentPackageKey;
   }

   public void setDocumentPackageKey(DocumentPackageKey documentPackageKey) {
      this.documentPackageKey = documentPackageKey;
   }

   public String getDescription() {
      return description;
   }

   public void setDescription(String description) {
      this.description = description;
   }

   public List<String> getReferences() {
      return references;
   }

   public void setReferences(List<String> references) {
      this.references = references;
   }

   public Map<String, DocumentType> getTypeList() {
      return typeList;
   }

   public void setTypeList(Map<String, DocumentType> typeList) {
      this.typeList = typeList;
   }

   @Override
   public String toString() {
      return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
   }

   @Override
   public int hashCode() {
      return HashCodeBuilder.reflectionHashCode(this);
   }

   @Override
   public boolean equals(Object obj) {
      return EqualsBuilder.reflectionEquals(this, obj);
   }

}


Code:
@Entity
@Table(name = "V_DCM_TYPE")
public class DocumentType implements Serializable {

   private static final long serialVersionUID = 4334119384625275660L;

   public static String ORDER_BY_NAME = "documentTypeKey.name";

   @EmbeddedId
   private DocumentTypeKey documentTypeKey = new DocumentTypeKey();

   @Column(name = "N_DOCUMENTO_AZIENDALE")
   private String description;

   @ManyToMany(fetch = FetchType.EAGER)
   @MapKeyColumn(name = "E_TPSISDK_K_ORDINAMENTO")
   @JoinTable(name = "V_DCM_TYPE_CLASS", joinColumns = {
         @JoinColumn(name = "K_DOCUMENTO_AZIENDALE", referencedColumnName = "K_DOCUMENTO_AZIENDALE"),
         @JoinColumn(name = "K_SOTTO_APPLICAZIONE", referencedColumnName = "K_SOTTO_APPLICAZIONE") }, inverseJoinColumns = {
         @JoinColumn(name = "K_CLASSE_DOCUMENTALE", referencedColumnName = "K_CLASSE_DOCUMENTALE"),
         @JoinColumn(name = "N_FOLDER_DOCUMENTO", referencedColumnName = "N_FOLDER_DOCUMENTO") })
   private Map<SystemId, DocumentClass> docClassMap = new HashMap<SystemId, DocumentClass>();

   @ManyToMany(fetch = FetchType.EAGER)
   @MapKey(name = "name")
   @JoinTable(name = "V_DCM_TYPE_PROPERTY", joinColumns = {
         @JoinColumn(name = "K_DOCUMENTO_AZIENDALE", referencedColumnName = "K_DOCUMENTO_AZIENDALE"),
         @JoinColumn(name = "K_SOTTO_APPLICAZIONE", referencedColumnName = "K_SOTTO_APPLICAZIONE") }, inverseJoinColumns = @JoinColumn(name = "K_METADATO_CLASSE_APP"))
   private final Map<String, DocumentProperty> docPropertyMap = new LinkedHashMap<String, DocumentProperty>();

   public void setDocumentTypeKey(DocumentTypeKey documentTypeKey) {
      this.documentTypeKey = documentTypeKey;
   }

   public DocumentTypeKey getDocumentTypeKey() {
      return documentTypeKey;
   }

   public Map<String, DocumentProperty> getDocPropertyMap() {
      return docPropertyMap;
   }

   @Transient
   public String getName() {
      return documentTypeKey.getName();
   }

   public void setName(final String name) {
      this.documentTypeKey.setName(name);
   }

   public String getDescription() {
      return description;
   }

   public void setDescription(final String description) {
      this.description = description;
   }

   public Map<SystemId, DocumentClass> getDocClassMap() {
      return docClassMap;
   }

   public void setDocClassMap(final Map<SystemId, DocumentClass> docClassMap) {
      this.docClassMap = docClassMap;
   }

   public List<DocumentProperty> getProperties() {
      return new ArrayList<DocumentProperty>(docPropertyMap.values());
   }

   public DocumentProperty getProperty(final String key) {
      return docPropertyMap.get(key);
   }

   public DocumentClass getDocClass(final SystemId dctm) {
      return docClassMap.get(dctm);
   }

   @Override
   public String toString() {
      return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
   }

   @Override
   public int hashCode() {
      return HashCodeBuilder.reflectionHashCode(this);
   }

   @Override
   public boolean equals(Object obj) {
      return EqualsBuilder.reflectionEquals(this, obj);
   }

   public void setApplicationDomainEnum(String domain) {
      this.documentTypeKey.setApplicationDomainEnum(domain);
   }
}

Code:
@Embeddable
public class DocumentTypeKey implements Serializable {

   private static final long serialVersionUID = -8198266723910996645L;

   @Column(name = "K_DOCUMENTO_AZIENDALE")
   private String name;

   @Column(name = "K_SOTTO_APPLICAZIONE")
   private String applicationDomainEnum;

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public String getApplicationDomainEnum() {
      return applicationDomainEnum;
   }

   public void setApplicationDomainEnum(String applicationDomainEnum) {
      this.applicationDomainEnum = applicationDomainEnum;
   }

   @Override
   public String toString() {
      return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
   }

   @Override
   public int hashCode() {
      return HashCodeBuilder.reflectionHashCode(this);
   }

   @Override
   public boolean equals(Object obj) {
      return EqualsBuilder.reflectionEquals(this, obj);
   }

}

Code:
@Embeddable
public class DocumentPackageKey implements Serializable {

   private static final long serialVersionUID = -4394344091441873454L;

   @Column(name = "K_TIPO_DOC_AZIENDALE")
   private String name;

   @Column(name = "E_SOTTAPP_K_SOTTO_APPLICAZIONE")
   private String applicationDomainEnum;

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public String getApplicationDomainEnum() {
      return applicationDomainEnum;
   }

   public void setApplicationDomainEnum(String applicationDomainEnum) {
      this.applicationDomainEnum = applicationDomainEnum;
   }

   @Override
   public String toString() {
      return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
   }

   @Override
   public int hashCode() {
      return HashCodeBuilder.reflectionHashCode(this);
   }

   @Override
   public boolean equals(Object obj) {
      return EqualsBuilder.reflectionEquals(this, obj);
   }

}



Any suggestion?

_________________
Luca Preziati


Last edited by luca.preziati on Fri Jun 24, 2011 7:42 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: HQL query on @ManyToMany query applied to Map
PostPosted: Thu Jun 23, 2011 5:50 am 
Newbie

Joined: Thu May 05, 2011 6:33 am
Posts: 16
In addition, I want only to know if a documentPackage is related to a documentType.

_________________
Luca Preziati


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.