geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "D. Strauss" <geron...@ds-2.de>
Subject Re: ejbQL with relations
Date Wed, 12 Jul 2006 16:28:50 GMT
Hello, Aaron,

funnily another task is coming along :P Now, my finder looks like

select distinct object(g) from Guild as g order by g.uildName asc,
g.realm.realmName asc

It is working AS LONG AS I don't use the prefetch setting All (for
loading all the cmr and cmp fields from the bean). When I use the
prefetch setting Default (load only the cmp fields) everything is
working. So, here is just another stacktrace (just = Just Another
StackTrace ... funny :P):

[SQLQueryBuilder] CMP [Entity logical name=[Guild]; physical
name=[Guild]] - entity load command compiled to [PrefetchQueryCommand
[JDBCQueryCommand sql=[SELECT G.id, G.name, G.homepageurl, T0.id,
T0.name, T0.warteschlange, T0.art, T0.aktiv FROM guilds G LEFT JOIN
realmlist T0 ON (T0.id = G.refrealm) WHERE G.id = ?]]]
Deployer operation failed: Unable to initialize EJB named 'Guild': null
org.apache.geronimo.common.DeploymentException: Unable to initialize EJB
named 'Guild': null
        at
org.openejb.deployment.CMPEntityBuilder.createBean(CMPEntityBuilder.java:208)
        at
org.openejb.deployment.CMPEntityBuilder.buildBeans(CMPEntityBuilder.java:120)
        at
org.openejb.deployment.OpenEJBModuleBuilder.addGBeans(OpenEJBModuleBuilder.java:525)
        at
org.openejb.deployment.OpenEJBModuleBuilder$$FastClassByCGLIB$$11bd7b20.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:122)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:817)
        at
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
        at
org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
        at
org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
        at
org.apache.geronimo.j2ee.deployment.ModuleBuilder$$EnhancerByCGLIB$$70ea3853.addGBeans(<generated>)
        at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:562)
        at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$$38e56ec6.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:122)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:817)
        at
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
        at
org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
        at
org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
        at
org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$7cd740c5.buildConfiguration(<generated>)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:302)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:124)
        at
org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:122)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:852)
        at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at
org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:106)
        at
org.apache.geronimo.deployment.plugin.local.RedeployCommand.redeploySameConfiguration(RedeployCommand.java:218)
        at
org.apache.geronimo.deployment.plugin.local.RedeployCommand.run(RedeployCommand.java:99)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
        at
org.tranql.builder.QueryTileBuilder.buildJoinCondition(QueryTileBuilder.java:198)
        at
org.tranql.builder.QueryTileBuilder.buildJoinCondition(QueryTileBuilder.java:129)
        at
org.tranql.sql.prefetch.PrefetchGroupTransform$Context.addFrom(PrefetchGroupTransform.java:126)
        at
org.tranql.sql.prefetch.PrefetchGroupTransform.visit(PrefetchGroupTransform.java:262)
        at org.tranql.ql.QuerySource.visit(QuerySource.java:46)
        at org.tranql.query.QueryCloner.visitChildren(QueryCloner.java:70)
        at org.tranql.query.QueryCloner.visit(QueryCloner.java:97)
        at org.tranql.ql.From.visit(From.java:30)
        at org.tranql.query.QueryCloner.visitChildren(QueryCloner.java:70)
        at org.tranql.query.QueryCloner.visit(QueryCloner.java:259)
        at
org.tranql.sql.prefetch.PrefetchGroupTransform.visit(PrefetchGroupTransform.java:168)
        at org.tranql.ql.Query.visit(Query.java:59)
        at
org.tranql.sql.prefetch.PrefetchGroupTransform.transform(PrefetchGroupTransform.java:137)
        at
org.tranql.builder.SQLQueryBuilder.buildFinders(SQLQueryBuilder.java:191)
        at
org.openejb.deployment.CMPContainerBuilder.buildIt(CMPContainerBuilder.java:282)
        at
org.openejb.deployment.AbstractContainerBuilder.createConfiguration(AbstractContainerBuilder.java:354)
        at
org.openejb.deployment.CMPEntityBuilder.createBean(CMPEntityBuilder.java:206)
        ... 33 more

Is it because there is not yet any data in the database? Switching back
to prefetch Default makes the EJB load. So, it still makes me curious :P

I'll switch back to Default. As you've written in your Geronimo Devel
book it's just a performance switch :P

Anyway, it's something that could make you stay awake at night ^^;;;;

Best regards

Dirk

Aaron Mulder schrieb:
> Glad to hear that you figured it out!  Thanks for following up.
> 
> Aaron
> 
> On 7/12/06, D. Strauss <geronimo@ds-2.de> wrote:
>> Hello, Aaron,
>>
>> after re-reading your answer I came up with a strange idea. After some
>> research and testing I can finally say: I was wrong ^^;;;;
>>
>> My ejbQL was
>>
>> select distinct object(g) from Guild as g, in (g.realm) as r order by
>> r.realmName asc
>>
>> But I learned a wrong ejbQL: the IN statement is for a collection. So,
>> you were right: realm IS NOT a collection but a simple lonely cmr field
>> that references another entity. I always thought that IN() is for
>> reading from a related bean (think of IN as an additional load).
>>
>> So, sorry for spamming the ML with this ^^;;;; my bad.
>>
>> For the curious people: the working ejbQL is:
>>
>> select distinct object(g) from Guild as g order by g.realm.realmName asc
>>
>> Best regards
>>
>> Dirk
>>
>> D. Strauss schrieb:
>> > Hello, Aaron
>> >
>> > seems that my "workaround" failed. As soon as a relation column is used
>> > within a finder ejbQL TranQL gives up ... or better said: it seems that
>> > it gives up. Here a nice stack trace that emphasizes my problem:
>> >
>> > Caused by: org.tranql.ql.QueryException: Finder [Finder
>> > method=[findAll]; EJB-QL=[select distinct object(g) from Guild as g, in
>> > (g.realm) as r order by g.guildName asc, r.realmName asc]]
>> >         at
>> >
>> org.tranql.sql.EJBQLToPhysicalQuery.buildFinder(EJBQLToPhysicalQuery.java:143)
>>
>> >         at
>> >
>> org.tranql.sql.EJBQLToPhysicalQuery.buildFinders(EJBQLToPhysicalQuery.java:90)
>>
>> >         ... 36 more
>> > Caused by: org.tranql.ql.QueryException: Parser, lexer or Tree-walker
>> > exception
>> >         at
>> >
>> org.tranql.sql.EJBQLToPhysicalQuery.getEJBQLQuery(EJBQLToPhysicalQuery.java:235)
>>
>> >         at
>> >
>> org.tranql.sql.EJBQLToPhysicalQuery.buildFinder(EJBQLToPhysicalQuery.java:130)
>>
>> >         ... 37 more
>> > Caused by: org.tranql.ql.MalformedNodeException: Path used must end
>> with
>> > a multi valued CMR field
>> >         at
>> org.tranql.ql.DerivedTable.getEntityType(DerivedTable.java:61)
>> >         at org.tranql.ql.DerivedTable.<init>(DerivedTable.java:36)
>> >         at
>> >
>> org.tranql.ejb.parser.EJBQL21Compiler.collection_member_declaration(EJBQL21Compiler.java:473)
>>
>> >         at
>> >
>> org.tranql.ejb.parser.EJBQL21Compiler.from_clause(EJBQL21Compiler.java:201)
>>
>> >         at
>> > org.tranql.ejb.parser.EJBQL21Compiler.ejbql(EJBQL21Compiler.java:115)
>> >         at
>> >
>> org.tranql.sql.EJBQLToPhysicalQuery.getEJBQLQuery(EJBQLToPhysicalQuery.java:233)
>>
>> >         ... 38 more
>> >
>> > So, it is a TranQL problem? Should I post this to the TranQL ML?
>> >
>> > Oh, before I forgot:
>> >
>> > Guild n:1 Realm
>> >
>> > (1 Realm can have multiple guilds, but 1 guild can only belong to 1
>> > Realm, so 1:n relation).
>> >
>> > My openejb-jar.xml for the relation looks like:
>> >
>> > <ejb-relation>
>> >       <ejb-relation-name>relGuildRealm</ejb-relation-name>
>> >       <ejb-relationship-role>
>> >               <ejb-relationship-role-name>
>> >                       r1
>> >               </ejb-relationship-role-name>
>> >               <relationship-role-source>
>> >                       <ejb-name>Guild</ejb-name>
>> >               </relationship-role-source>
>> >               <cmr-field>
>> >                       <cmr-field-name>realm</cmr-field-name>
>> >               </cmr-field>
>> >               <foreign-key-column-on-source />
>> >               <role-mapping>
>> >                       <cmr-field-mapping>
>> >                               <key-column>id</key-column>
>> >                               <foreign-key-column>
>> >                                       refrealm
>> >                               </foreign-key-column>
>> >                       </cmr-field-mapping>
>> >               </role-mapping>
>> >       </ejb-relationship-role>
>> > </ejb-relation>
>> >
>> > Let me know if you need more information.
>> >
>> > Best regards
>> >
>> > Dirk
>> >
>> > Aaron Mulder schrieb:
>> >> My guess would be that r.partei refers to a single entity (as in a
>> >> 1-to-1 relationship between r and p) but the "in" operator expects its
>> >> argument to be a group or set (as in a 1-to-many) relationship.  Does
>> >> that sound right?
>> >>
>> >> Thanks,
>> >>    Aaron
>> >>
>> >> On 7/7/06, D. Strauss <geronimo@ds-2.de> wrote:
>> >>> Hello, ejbQL profs ^^
>> >>>
>> >>> seems that I missunderstood my ejbQL knowledge. I setup some ejbs and
>> >>> wanted to create some finder methods (ejb-jar.xml). Unfortunately,
>> >>> Geronimo (or OpenEJB?) ends in an exception that I can't figure
>> out what
>> >>> it wants to tell me.
>> >>>
>> >>>
>> >>>
>> >>> Caused by: org.tranql.ql.QueryException: Finder [Finder
>> >>> method=[findAll]; EJB-QL=[select distinct object(r) from Rasse as
>> r, in
>> >>> (r.partei) as p order by p.parteiName asc,r.rassenName asc]]
>> >>>         at
>> >>>
>> org.tranql.sql.EJBQLToPhysicalQuery.buildFinder(EJBQLToPhysicalQuery.java:143)
>>
>> >>>
>> >>>         at
>> >>>
>> org.tranql.sql.EJBQLToPhysicalQuery.buildFinders(EJBQLToPhysicalQuery.java:90)
>>
>> >>>
>> >>>         ... 36 more
>> >>> Caused by: org.tranql.ql.QueryException: Parser, lexer or Tree-walker
>> >>> exception
>> >>>         at
>> >>>
>> org.tranql.sql.EJBQLToPhysicalQuery.getEJBQLQuery(EJBQLToPhysicalQuery.java:235)
>>
>> >>>
>> >>>         at
>> >>>
>> org.tranql.sql.EJBQLToPhysicalQuery.buildFinder(EJBQLToPhysicalQuery.java:130)
>>
>> >>>
>> >>>         ... 37 more
>> >>> Caused by: org.tranql.ql.MalformedNodeException: Path used must
>> end with
>> >>> a multi valued CMR field
>> >>>         at
>> org.tranql.ql.DerivedTable.getEntityType(DerivedTable.java:61)
>> >>>         at org.tranql.ql.DerivedTable.<init>(DerivedTable.java:36)
>> >>>         at
>> >>>
>> org.tranql.ejb.parser.EJBQL21Compiler.collection_member_declaration(EJBQL21Compiler.java:473)
>>
>> >>>
>> >>>         at
>> >>>
>> org.tranql.ejb.parser.EJBQL21Compiler.from_clause(EJBQL21Compiler.java:201)
>>
>> >>>
>> >>>         at
>> >>> org.tranql.ejb.parser.EJBQL21Compiler.ejbql(EJBQL21Compiler.java:115)
>> >>>         at
>> >>>
>> org.tranql.sql.EJBQLToPhysicalQuery.getEJBQLQuery(EJBQLToPhysicalQuery.java:233)
>>
>> >>>
>> >>>         ... 38 more
>> >>>
>> >>>
>> >>> So, basically, the ejbQL
>> >>>         select distinct object(r) from Rasse as r, in (r.partei) as
p
>> >>> order by
>> >>> p.parteiName asc,r.rassenName asc
>> >>> is wrong. However, the ejbQL
>> >>>         select distinct object(r) from Rasse as r order by
>> >>> r.rassenName asc
>> >>> works.
>> >>>
>> >>> Does anyone know what "Path used must end with a multi valued CMR
>> field"
>> >>> mean?
>> >>>
>> >>> Or is this somehow related to the prefetch system by Geronimo?
>> >>>
>> >>> Best regards
>> >>>
>> >>> Dirk
>> >>>
>> >>
>> >
>> >
>>
> 
> 

Mime
View raw message