[Hibernate-JIRA] Created: (HHH-2641) Collection Loading
by Frederico (JIRA)
Collection Loading
------------------
Key: HHH-2641
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2641
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.0 final
Environment: Hibernate3, Postgresql 8.1
Reporter: Frederico
Attachments: src.tar.gz
I'm not sure if this is a bug, but no one answered me in the hibernate forum, so....
I have a collection that it is not loaded, in log it seems to be ok, but when i access the collection there is no element.
<class
name="entidades.bdufop.Sistema"
table="sistema"
schema="public"
>
<id
name="codigo"
column="codigo"
type="java.lang.String"
>
<generator class="assigned">
</generator>
</id>
<property
name="descricao"
type="java.lang.String"
update="true"
insert="true"
column="descricao"
not-null="true"
/>
<property
name="disponivel"
type="java.lang.String"
update="true"
insert="true"
column="disponivel"
not-null="true"
/>
<property
name="mensagem"
type="java.lang.String"
update="true"
insert="true"
column="mensagem"
/>
<set name="aplicacoes" lazy="true" cascade="all">
<key column="cod_sistema"/>
<one-to-many class="entidades.bdufop.Aplicacao"/>
</set>
</class>
<class
name="entidades.bdufop.Aplicacao"
table="aplicacao"
schema="public"
>
<composite-id
name="id"
class="entidades.bdufop.Aplicacao_pk"
>
<key-property
name="codigo_sistema"
type="java.lang.String"
column="cod_sistema"
/>
<key-property
name="codigo_aplicacao"
type="java.lang.String"
column="codigo"
/>
</composite-id>
<many-to-one name="sistema"
class="entidades.bdufop.Sistema"
column="cod_sistema"
insert="false"
update="false"
unique="true"
not-null="true"/>
<property
name="descricao"
type="java.lang.String"
column="descricao"
not-null="true"
/>
<property
name="versao"
type="java.lang.String"
column="versao"
/>
<property
name="dt_versao"
type="java.util.Date"
column="dt_versao"
/>
<property
name="disponivel"
type="java.lang.String"
column="disponivel"
not-null="true"
/>
<property
name="url"
type="java.lang.String"
column="url"
/>
<property
name="mensagem"
type="java.lang.String"
column="mensagem"
/>
</class>
Log
12:21:42,060 DEBUG DefaultInitializeCollectionEventListener:41 - initializing collection [entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:42,063 DEBUG DefaultInitializeCollectionEventListener:47 - checking second-level cache
12:21:42,067 DEBUG DefaultInitializeCollectionEventListener:59 - collection not cached
12:21:42,071 DEBUG Loader:1911 - loading collection: [entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:42,075 DEBUG AbstractBatcher:311 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
12:21:42,079 DEBUG ConnectionManager:415 - opening JDBC connection
12:21:42,118 DEBUG SQL:346 - select aplicacoes0_.cod_sistema as cod1_1_, aplicacoes0_.codigo as codigo1_, aplicacoes0_.cod_sistema as cod1_1_0_, aplicacoes0_.codigo as codigo1_0_, aplicacoes0_.descricao as descricao1_0_, aplicacoes0_.versao as versao1_0_, aplicacoes0_.dt_versao as dt5_1_0_, aplicacoes0_.disponivel as disponivel1_0_, aplicacoes0_.url as url1_0_, aplicacoes0_.mensagem as mensagem1_0_ from public.aplicacao aplicacoes0_ where aplicacoes0_.cod_sistema=?
Hibernate: select aplicacoes0_.cod_sistema as cod1_1_, aplicacoes0_.codigo as codigo1_, aplicacoes0_.cod_sistema as cod1_1_0_, aplicacoes0_.codigo as codigo1_0_, aplicacoes0_.descricao as descricao1_0_, aplicacoes0_.versao as versao1_0_, aplicacoes0_.dt_versao as dt5_1_0_, aplicacoes0_.disponivel as disponivel1_0_, aplicacoes0_.url as url1_0_, aplicacoes0_.mensagem as mensagem1_0_ from public.aplicacao aplicacoes0_ where aplicacoes0_.cod_sistema=?
12:21:42,122 DEBUG AbstractBatcher:424 - preparing statement
12:21:42,129 DEBUG StringType:80 - binding 'ACESSO' to parameter: 1
12:21:42,144 DEBUG AbstractBatcher:327 - about to open ResultSet (open ResultSets: 0, globally: 0)
12:21:42,148 DEBUG Loader:1040 - result set contains (possibly empty) collection: [entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:42,152 DEBUG CollectionLoadContext:84 - uninitialized collection: initializing
12:21:42,509 DEBUG Loader:682 - processing result set
12:21:42,513 DEBUG Loader:687 - result set row: 0
12:21:42,517 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_0_
12:21:42,542 DEBUG StringType:122 - returning 'AP.ACESSO ' as column: codigo1_0_
12:21:42,550 DEBUG Loader:1164 - result row: EntityKey[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:42,558 DEBUG Loader:1347 - Initializing object from ResultSet: [entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:42,563 DEBUG AbstractEntityPersister:1860 - Hydrating entity: [entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:42,574 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_0_
12:21:42,579 DEBUG StringType:122 - returning 'DESCRICAO APLICACAO ACESSO ' as column: descricao1_0_
12:21:42,586 DEBUG StringType:122 - returning ' ' as column: versao1_0_
12:21:42,592 DEBUG TimestampType:122 - returning '2008-01-01 00:00:00' as column: dt5_1_0_
12:21:42,598 DEBUG StringType:122 - returning 'S' as column: disponivel1_0_
12:21:42,602 DEBUG StringType:122 - returning '' as column: url1_0_
12:21:42,608 DEBUG StringType:122 - returning '' as column: mensagem1_0_
12:21:42,613 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_
12:21:42,618 DEBUG Loader:972 - found row of collection: [entidades.bdufop.Sistema.aplicacoes#ACESSO ]
12:21:42,640 DEBUG CollectionLoadContext:100 - new collection: instantiating
12:21:42,659 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_
12:21:42,665 DEBUG StringType:122 - returning 'AP.ACESSO ' as column: codigo1_
12:21:42,671 DEBUG DefaultLoadEventListener:153 - loading entity: [entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:42,677 DEBUG DefaultLoadEventListener:304 - attempting to resolve: [entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:42,687 DEBUG DefaultLoadEventListener:313 - resolved object in session cache: [entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:42,712 DEBUG Loader:709 - done processing result set (1 rows)
12:21:42,716 DEBUG AbstractBatcher:334 - about to close ResultSet (open ResultSets: 1, globally: 1)
12:21:42,721 DEBUG AbstractBatcher:319 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
12:21:42,757 DEBUG AbstractBatcher:470 - closing statement
12:21:42,806 DEBUG ConnectionManager:398 - aggressively releasing JDBC connection
12:21:42,815 DEBUG ConnectionManager:435 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
12:21:42,821 DEBUG Loader:839 - total objects hydrated: 1
12:21:42,829 DEBUG TwoPhaseLoad:107 - resolving associations for [entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:42,834 DEBUG DefaultLoadEventListener:153 - loading entity: [entidades.bdufop.Sistema#ACESSO ]
12:21:42,874 DEBUG DefaultLoadEventListener:230 - creating new proxy for entity
12:21:43,422 DEBUG TwoPhaseLoad:206 - done materializing entity [entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO , codigo_sistema=ACESSO }]
12:21:43,427 DEBUG CollectionLoadContext:262 - 2 collections were found in result set for role: entidades.bdufop.Sistema.aplicacoes
12:21:43,432 DEBUG CollectionLoadContext:206 - collection fully initialized: [entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:43,436 DEBUG CollectionLoadContext:206 - collection fully initialized: [entidades.bdufop.Sistema.aplicacoes#ACESSO ]
12:21:43,441 DEBUG CollectionLoadContext:272 - 2 collections initialized for role: entidades.bdufop.Sistema.aplicacoes
12:21:43,445 DEBUG StatefulPersistenceContext:748 - initializing non-lazy collections
12:21:43,449 DEBUG Loader:1935 - done loading collection
12:21:43,453 DEBUG DefaultInitializeCollectionEventListener:61 - collection initialized
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 8 months
[Hibernate-JIRA] Commented: (HHH-1131) setting classloader in CGLIB class generators
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1131?page=c... ]
Max Rydahl Andersen commented on HHH-1131:
------------------------------------------
please explain me why the current thread classloader at the time cglib loads is classes is not the correct one to use ?
This indicates to me that the classloader is not correctly setup when you are running the app....
> setting classloader in CGLIB class generators
> ---------------------------------------------
>
> Key: HHH-1131
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1131
> Project: Hibernate3
> Issue Type: Improvement
> Components: core
> Affects Versions: 3.0.5
> Environment: Hibernate 3.0.5, Oracle 10
> Reporter: Moshe Ben Shoham
>
> In my application I am loading plug-ins mapping documents and persistent classes from jars using some UrlClassLoaders (one per plugin). I then set the threadContextClassLoader to be the CompositeClassLoader that holds all those UrlClassLoaders. Everything works fine until I add a proxy to one of the mapping document (I simplified the names a little):
> <hibernate-mapping>
> <subclass
> name="myplugin.MyExtension"
> discriminator-value="3"
> proxy="myplugin.IMyExtension"
> extends="core.MyBasicClass"
> >
> <join table="MY_EXTENSION">
> <key column="ENTITY_ID"/>
> <property name="extraNumData" column="EXTRA_NUM_DATA" type="long"/>
> <property name="extraStrData" column="EXTRA_STR_DATA" type="string"/>
> </join>
> </subclass >
> </hibernate-mapping>
> See below the exception I get.
> Hibernate uses net.sf.cglib.proxy.Enhancer as the class generator in CGLIBLazyInitializer.getProxyFactory(). Now, it seeme like CGLIB allows customizing the ClassLoader used by its class generators using the method net.sf.cglib.core.AbstractClassGenerator.setClassLoader() (Enhancer extends AbstractClassGenerator). But, it doesn't seem like it is possible to use it in Hibernate, because this is how the Enhancer is used in CGLIBLazyInitializer.getProxyFactory() :
> return (Factory) Enhancer.create(
> (interfaces.length==1) ? persistentClass : null,
> interfaces,
> NULL_METHOD_INTERCEPTOR
> );
> If I replace it with the following code, it works:
> Enhancer e = new Enhancer();
> e.setSuperclass((interfaces.length==1) ? persistentClass : null);
> e.setInterfaces(interfaces);
> e.setCallback(NULL_METHOD_INTERCEPTOR);
> e.setClassLoader(Thread.currentThread().getContextClassLoader()); // this is the addition!
> return (Factory)e.create();
> Is there any other way I can do it (I know I can implement my own persister, but it seems like there's too much code that needs to be overridden...)?
> Is there any planned enhancement regarding this issue?
> Full stack trace of any exception that occurs:
> CGLIB Enhancement failed: com.octavian.fas.domain.business.BusinessTransaction
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:236)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:373)
> at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:281)
> at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:640)
> at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:94)
> at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:42)
> at org.hibernate.tuple.PojoTuplizer.buildProxyFactory(PojoTuplizer.java:144)
> at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:83)
> at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:54)
> at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:47)
> at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:218)
> at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
> at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
> at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
> at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:211)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
> at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:777)
> at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:703)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1058)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
> at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
> at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
> at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
> at com.octavian.sma.analytical.batch.SpringHelper.init(SpringHelper.java:77)
> at com.octavian.sma.analytical.batch.SpringHelper.<init>(SpringHelper.java:38)
> at com.octavian.sma.analytical.batch.dailynongrouping.DailyNonGroupingAnalyticalBatch.initSpringHelper(DailyNonGroupingAnalyticalBatch.java:44)
> at com.octavian.sma.analytical.batch.AnalyticalBatch.run(AnalyticalBatch.java:58)
> at com.octavian.sma.analytical.batch.dailynongrouping.DailyNonGroupingAnalyticalBatch.main(DailyNonGroupingAnalyticalBatch.java:29)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:373)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:218)
> ... 28 more
> Caused by: java.lang.NoClassDefFoundError: myplugin/IMyBusinessTransactionExtension
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 33 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 8 months
[Hibernate-JIRA] Resolved: (HHH-1742) SQL join is missed in Criteria queries for join/alias on foreign key as part of composite primary key (many-to-one association)
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1742?page=c... ]
Diego Pires Plentz resolved HHH-1742.
-------------------------------------
Assignee: Diego Pires Plentz
Resolution: Duplicate
Closing this issue as dup because it is older then HHH-1570. Btw, it has more info.
> SQL join is missed in Criteria queries for join/alias on foreign key as part of composite primary key (many-to-one association)
> -------------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1742
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1742
> Project: Hibernate3
> Issue Type: Bug
> Components: query-criteria
> Affects Versions: 3.2.0 cr1
> Environment: Windows XP, Oracle 10g, HSQLDB
> Reporter: Viatcheslav Sysoltsev (Slavka)
> Assignee: Diego Pires Plentz
> Attachments: HibernateTest.zip
>
>
> I've stuck with Criteria API on issue, that the join is sometimes missed from generated SQL query doing joining on foreign key.
> Here is the little example I've made to demonstrate the problem (also attached as standalone runnable eclipse project)
> There are two tables:
> FAMILY
> familyName as primary key
> familyProperty
> PERSON
> familyName as foreign key on FAMILY } the both fields make primary key
> personName } of PERSON
> Doing query on person like
> session.createCriteria(Person.class)
> .createCriteria("id.family")
> .add(Restrictions.eq("familyProperty", "whatever"))
> .list();
> Causes query
> Hibernate: select this_.FAMILY_NAME as FAMILY1_1_0_, this_.PERSON_NAME as PERSON2_1_0_ from PERSON this_ where family1_.FAMILY_PROPERTY=?
> .. which is rather invalid
> The same by the way happens doing query
> session.createCriteria(Person.class)
> .createCriteria("id.family")
> .add(Restrictions.eq("familyName", "whatever"))
> .list();
> The query
> select this_.FAMILY_NAME as FAMILY1_1_0_, this_.PERSON_NAME as PERSON2_1_0_ from PERSON this_ where family1_.FAMILY_NAME=?
> .. is invalid either though it can be made valid without join, because family1_.FAMILY_NAME can be accessed through this_.FAMILY_NAME
> The attachment is a whole eclipse project, pretty straightforward, with hsqldb, which demonstrates the SQL generated and the problem.
> I suspect this bug may be caused by the fix to HH-528 (component.manyToOne.id in HQL causes join).
> The priority should be high because
> session.createCriteria(Person.class)
> .createAlias("id.family", "family")
> .add(Restrictions.eq("family.familyProperty", "whatever"))
> .list();
> doesn't work either.
> In effect there is no way to cause join on foreign key with Criteria API. Whatever in hibernate blocks join on foreign key rather zealous.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 8 months
[Hibernate-JIRA] Resolved: (HHH-971) ConcurrentModificationException with <many-to-one property_ref="..."/> in a set of composite elements
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-971?page=co... ]
Diego Pires Plentz resolved HHH-971.
------------------------------------
Assignee: Diego Pires Plentz
Resolution: Duplicate
> ConcurrentModificationException with <many-to-one property_ref="..."/> in a set of composite elements
> -----------------------------------------------------------------------------------------------------
>
> Key: HHH-971
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-971
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Environment: Hibernate 3.1 beta 3, Java 1.4.2_08
> Reporter: Emmanuel Bourg
> Assignee: Diego Pires Plentz
>
> I tried to drop the latest 3.1-beta3 jar in my application currently working with hibernate 3.0.5 to test the new features and found out that an exception is now thrown when the SessionFactory is build :
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:448)
> at java.util.AbstractList$Itr.remove(AbstractList.java:433)
> at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1006)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1120)
> at myapp.dao.impl.hibernate.SessionManager.init(SessionManager.java:74)
> I tracked down the issue to the mapping of a many-to-one association using a property-ref inside a set of composite elements. The mapping generating this error looks like this:
> <set name="children" table="CHILD">
> <key column="PARENT_ID"/>
> <composite-element class="Child">
> <many-to-one name="foo" column="FOO" property-ref="alternateId"/>
> </composite-element>
> </set>
> A many-to-one association with a property-ref outside a composite element didn't cause this exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 8 months
[Hibernate-JIRA] Resolved: (HHH-1350) HQL inner join with composite key not anymore working in 3.1
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1350?page=c... ]
Diego Pires Plentz resolved HHH-1350.
-------------------------------------
Assignee: Diego Pires Plentz
Resolution: Won't Fix
> HQL inner join with composite key not anymore working in 3.1
> ------------------------------------------------------------
>
> Key: HHH-1350
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1350
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1
> Environment: Hibernate 3.1
> JDK 1.4.2_03
> Weblogic 8.1 SP3
> Reporter: Kermitt
> Assignee: Diego Pires Plentz
> Priority: Minor
>
> While migrating from hib 3.0.5 to 3.1 this error appear:
> id is a composite key containing accessphonenumbers
> 10 janv. 11:49:00:ERROR (ErrorCounter.reportError) - illegal syntax near collection: id
> 10 janv. 11:49:00:ERROR (ErrorCounter.reportError) - illegal syntax near collection: id
> 10 janv. 11:49:00:ERROR (ErrorCounter.reportError) - illegal syntax near collection: id
> 10 janv. 11:49:00:ERROR (ErrorCounter.reportError) - illegal syntax near collection: id
> 10 janv. 11:49:00:ERROR (SessionFactoryImpl.<init>) - Error in named query: get.free.groupedphone.by_groupid
> org.hibernate.QueryException: could not resolve property: accessphonenumbers of: com.x.y.common.db.hib.vo.fulfilment.Groupedphonenumbers [
> select groups.groupid,phones
> from com.x.y.common.db.hib.vo.fulfilment.Accessnumbergroups as groups
> inner join groups.groupedphonenumbersSet.id.accessphonenumbers as phones
> where phones.bridges=:bridge_id
> and phones.accesstypes=:accesstype_id
> and groups.groupid=:group_id
>
> ]
> at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
> at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
> at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1265)
> at org.hibernate.persister.collection.AbstractCollectionPersister.toType(AbstractCollectionPersister.java:1255)
> at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:278)
> at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:372)
> at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:528)
> at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:221)
> at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:172)
> at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
> at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:313)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3258)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3050)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2928)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:686)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:542)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:279)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:227)
> at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
> at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
> at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:105)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:363)
> at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:327)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
> at com.genesys.frameworks.db.hibernate_classic.GenStartup.buildHibernateSession(GenStartup.java:151)
> at com.genesys.hermes.common.util.MainHibernateStartup.startHibernate(MainHibernateStartup.java:57)
> at com.genesys.hermes.common.util.MainHibernateStartup.main(MainHibernateStartup.java:17)
> 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:324)
> at weblogic.j2ee.AppLifecycleListenerInternal.invokeMain(AppLifecycleListenerInternal.java:61)
> at weblogic.j2ee.AppLifecycleListenerInternal.preStart(AppLifecycleListenerInternal.java:34)
> at weblogic.j2ee.ListenerInvocationAction.run(ListenerInvocationAction.java:50)
> at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
> at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
> at weblogic.j2ee.J2EEApplicationContainer.notifySecureListener(J2EEApplicationContainer.java:4721)
> at weblogic.j2ee.J2EEApplicationContainer.notify(J2EEApplicationContainer.java:4683)
> at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1005)
> at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2444)
> at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2394)
> at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2310)
> at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:866)
> at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:594)
> at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:508)
> at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 8 months
[Hibernate-JIRA] Resolved: (HHH-1897) NPE if HQL refers to nonexistant variable
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1897?page=c... ]
Diego Pires Plentz resolved HHH-1897.
-------------------------------------
Assignee: Diego Pires Plentz
Resolution: Duplicate
> NPE if HQL refers to nonexistant variable
> -----------------------------------------
>
> Key: HHH-1897
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1897
> Project: Hibernate3
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.2.0.cr2
> Reporter: Koda Janh
> Assignee: Diego Pires Plentz
>
> Given the query:
> "from mobi.gateway.domain.Server as server where server not in (select user.server from mobi.gateway.domain.User where user.server is not null) group by server.hostname order by count(server.port) desc limit 1"
> Hibernate throws this exception:
> java.lang.NullPointerException
> at org.hibernate.hql.ast.tree.IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:195)
> at org.hibernate.hql.ast.tree.IdentNode.resolve(IdentNode.java:85)
> at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:139)
> at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:469)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRef(HqlSqlBaseWalker.java:1080)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1877)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1821)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1392)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4243)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4152)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3859)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> if I add "as user" after "mobi.gateway.domain.User" the problem goes away. I would expect Hibernate to handle this more gracefully and maybe explain there is a mistake in the HQL statement, such as "user is undefined".
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 8 months
[Hibernate-JIRA] Resolved: (HHH-1609) EJBQL null pointer exception in parsing bad EJBQL does not help troubleshoot syntax errors
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1609?page=c... ]
Diego Pires Plentz resolved HHH-1609.
-------------------------------------
Assignee: Diego Pires Plentz
Resolution: Fixed
Fix Version/s: 3.2.0.cr3
> EJBQL null pointer exception in parsing bad EJBQL does not help troubleshoot syntax errors
> ------------------------------------------------------------------------------------------
>
> Key: HHH-1609
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1609
> Project: Hibernate3
> Issue Type: Improvement
> Components: query-hql
> Affects Versions: 3.1.1
> Reporter: Andrew Robinson
> Assignee: Diego Pires Plentz
> Priority: Minor
> Fix For: 3.2.0.cr3
>
>
> The following EJBQL (which is lacking the alias 'u' for the User object) produces a null pointer exception:
> select u from User where u.username = :username
> Exception:
> Caused by: java.lang.NullPointerException
> at org.hibernate.hql.ast.tree.IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:195)
> at org.hibernate.hql.ast.tree.IdentNode.resolve(IdentNode.java:85)
> at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:139)
> at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:397)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4316)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1211)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3518)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
> at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
> at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:134)
> at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113)
> at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1602)
> at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:54)
> This type of syntax error handling make troubleshooting the problem extremely difficult
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 8 months