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 Sat, 08 Jul 2006 08:43:48 GMT
Hello,

after some more hours of debugging here some new info about the problem:

Seems that only finder methods are affected. The ejbQL

select distinct object(r) from Rasse as r order by r.rassenName asc

becomes

SELECT R.name, T0.name FROM voelkertab R LEFT JOIN parteientab T0 ON
(T0.name = R.refseite) WHERE R.name = ?

I tried this SQL statement with my MySQL server and it works ;) so no
problem from the database.

XD5 generates the following openejb-jar stuff:

...
<entity>
	<ejb-name>Partei</ejb-name>
	<local-jndi-name>ejb/wowdb/Partei</local-jndi-name>
	<table-name>parteientab</table-name>
	<cmp-field-mapping>
		<cmp-field-name>parteiName</cmp-field-name>
		<table-column>name</table-column>
	</cmp-field-mapping>
	<primkey-field>parteiName</primkey-field>
	<prefetch-group>
		<group>
			<group-name>Default</group-name>
			<cmp-field-name>parteiName</cmp-field-name>
		</group>
		<group>
			<group-name>All</group-name>
			<cmp-field-name>parteiName</cmp-field-name>
		</group>
		<entity-group-mapping>
			<group-name>All</group-name>
		</entity-group-mapping>
	</prefetch-group>
	<query>
		<query-method>
			<method-name>findAll</method-name>
			<method-params />
		</query-method>
		<group-name>All</group-name>
	</query>
</entity>
<entity>
	<ejb-name>Rasse</ejb-name>
	<local-jndi-name>ejb/wowdb/Rasse</local-jndi-name>
	<table-name>voelkertab</table-name>
	<cmp-field-mapping>
		<cmp-field-name>rassenName</cmp-field-name>
		<table-column>name</table-column>
	</cmp-field-mapping>
	<primkey-field>rassenName</primkey-field>
	<prefetch-group>
		<group>
			<group-name>Default</group-name>
			<cmp-field-name>rassenName</cmp-field-name>
		</group>
		<group>
			<group-name>All</group-name>
			<cmp-field-name>rassenName</cmp-field-name>
			<cmr-field>										<cmr-field-name>partei</cmr-field-name>
				<group-name>All</group-name>
			</cmr-field>
		</group>
		<entity-group-mapping>
			<group-name>All</group-name>
		</entity-group-mapping>
	</prefetch-group>
	<query>
		<query-method>
			<method-name>findAll</method-name>
			<method-params />
		</query-method>
		<group-name>All</group-name>
	</query>
</entity>
...

This will end in:

[SQLQueryBuilder] CMP [Entity logical name=[Rasse]; physical
name=[Rasse]] - entity load command compiled to [PrefetchQueryCommand
[JDBCQueryCommand sql=[SELECT R.name, T0.name FROM voelkertab R LEFT
JOIN parteientab T0 ON (T0.name = R.refseite) WHERE R.name = ?]]]
Deployer operation failed: Unable to initialize EJB named 'Rasse': null
org.apache.geronimo.common.DeploymentException: Unable to initialize EJB
named 'Rasse': 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)

I'll now try to exchange the group-name. Maybe that makes Geronimo load
my ear :/


D. Strauss schrieb:
> 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