on ‎2007 Jun 22 11:33 AM
Hello Forum,
I have some problems in creating and using named queries declared via
class level annotations.
I declared the following named query:
[code]@NamedQueries({
@NamedQuery(name = SapUserDataContext.NAMED_QUERY_NAME_COUNT_QUERY,
query = "SELECT COUNT(obj.databaseId) FROM SapUserData AS obj WHERE "
+ "obj.sapCustomerId"
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_CUSTOMER_ID
+ " AND "
+ "obj.sapSystemId"
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_SYSTEM_ID
+ " AND "
+ "obj.sapServerId"
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_SERVER_ID
+ " AND "
+ "obj.dayOfAggregation"
+ "= :"
+ DayContext.COLUMN_NAME_DAY_OF_AGGREGATION
+ " AND "
+ "obj.timeSlice"
+ "= :"
+ TimeSliceContext.COLUMN_NAME_TIME_SLICE),
})
public class SapUserData extends AbstractSapUserData {
...
}[/code]
When executing that query I encounter the following errors:
[code][EXCEPTION]
#1#java.lang.IllegalArgumentException: line 1: Comparison '=' not defined for dependent objects
SELECT COUNT(obj.databaseId) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^
line 1: Path 'obj' (SapUserData) has no component 'timeSlice'
SELECT COUNT(obj.databaseId) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^
at com.sap.engine.lib.orpersistence.ejbqlparser.JPQLParserFacade.parseJQPL(JPQLParserFacade.java:30)
at com.sap.engine.services.orpersistence.query.QueryImpl.calculateJPQLQueryData(QueryImpl.java:102)
at com.sap.engine.services.orpersistence.query.QueryImpl.precompileQueries(QueryImpl.java:83)
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl$MetaDataImpl.<init>(EntityManagerFactoryImpl.java:153)
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl.getPersistenceUnitData(EntityManagerFactoryImpl.java:124)
at com.sap.engine.services.orpersistence.core.PersistenceContextImpl.<init>(PersistenceContextImpl.java:69)
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerImpl.<init>(EntityManagerImpl.java:71)
at com.sap.engine.services.orpersistence.entitymanager.JtaEntityManagerFactoryImpl.createEntityManagerInternal(JtaEntityManagerFactoryImpl.java:57)
at com.sap.engine.services.orpersistence.entitymanager.JtaEntityManagerFactoryImpl.createEntityManager(JtaEntityManagerFactoryImpl.java:49)
at com.sap.engine.services.orpersistence.container.EMManager.createEntityManager(EMManager.java:202)
at com.sap.engine.services.orpersistence.container.EMManager.getTransactionEntityManager(EMManager.java:60)
at com.sap.engine.services.orpersistence.container.EntityManagerProxy.getEntityManager(EntityManagerProxy.java:241)
at com.sap.engine.services.orpersistence.container.EntityManagerProxy.createNamedQuery(EntityManagerProxy.java:153)
at de.collogia.sapmon.worker.beans.service.user.SapCurrentUsersServiceBean.checkRecordExistence(SapCurrentUsersServiceBean.java:233)
at de.collogia.sapmon.worker.beans.service.user.SapCurrentUsersServiceBean.storeCurrentUserList(SapCurrentUsersServiceBean.java:109)
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:585)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:43)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext$InvocationContextImpl.proceed(AbstractInvocationContext.java:131)
at de.collogia.sapmon.worker.beans.interceptors.SapmonInterceptorLogServiceExecMethodStore.logServiceExecution(SapmonInterceptorLogServiceExecMethodStore.java:79)
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:585)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Application.invoke(Interceptors_Application.java:34)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:23)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at com.sap.engine.services.ejb3.runtime.impl.RemoteEJBProxyInvocationHandler.invoke(RemoteEJBProxyInvocationHandler.java:46)
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:585)
at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:237)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:253)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:109)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:841)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:125)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:59)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:168)[/code]
The main problem is that I'm unable to write the named query in a way that is
accepted by JBoss app. server and SAP NetWeaver app. server which
is an important fact because we are doing cross platform development.
On JBoss I'm able to write the query using the physical column names for both -
the field name I want to include in the where clause and for the named query parameter associated with the current field.
So the query working perfectly on JBoss lokks like that:
[code]@NamedQueries({
@NamedQuery(name = SapTaskDataContext.NAMED_QUERY_NAME_COUNT_QUERY,
query = "SELECT COUNT(*) FROM SapUserData AS obj WHERE "
+ SapResultDataContext.COLUMN_NAME_SAP_CUSTOMER_ID
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_CUSTOMER_ID
+ " AND "
+ SapResultDataContext.COLUMN_NAME_SAP_SYSTEM_ID
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_SYSTEM_ID
+ " AND "
+ SapResultDataContext.COLUMN_NAME_SAP_SERVER_ID
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_SERVER_ID
+ " AND "
+ DayContext.COLUMN_NAME_DAY_OF_AGGREGATION
+ "= :"
+ DayContext.COLUMN_NAME_DAY_OF_AGGREGATION
+ " AND "
+ TimeSliceContext.COLUMN_NAME_TIME_SLICE
+ "= :"
+ TimeSliceContext.COLUMN_NAME_TIME_SLICE),
})
public class SapUserData extends AbstractSapUserData {
...
}[/code]
The main difference is that I'm using the physical column name for referencing
the fields:
[code] query = "SELECT COUNT(*) FROM SapUserData AS obj WHERE "
+ SapResultDataContext.COLUMN_NAME_SAP_CUSTOMER_ID <-- Physical column name used to reference the field
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_CUSTOMER_ID<-- Physical column name used to declare the named query parameter also[/code]
I've chosen that way because JBoss complains when using the real field names
within named queries:
[code]12:35:57,962 WARN [FromElementType] Using non-qualified column reference [sapCustomerId -> ([sap_customer_id])]
12:35:57,963 WARN [FromElementType] Using non-qualified column reference [sapSystemId -> ([sap_system_id])]
12:35:57,963 WARN [FromElementType] Using non-qualified column reference [sapServerId -> ([sap_server_id])]
12:35:57,963 WARN [FromElementType] Using non-qualified column reference [dayOfAggregation -> ([day_of_aggregation,weekday])][/code]
The main problem I have ist that I'm unsure about what is most close to the EJB 3.0/ JPA 1.0 standards.
The other problem is that both app servers are unable to reference the field
timeSlice when using the named query declaration that is accepted by
the NetWeaver app. server.
[code]line 1: Path 'obj' (SapUserData) has no component 'timeSlice'
SELECT COUNT(obj.databaseId) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^[/code]
Is it correct if I assume that this error is related to the fact that the timeSlice field
is declared as private member in the base class (AbstractSapUserData) of
class SapUserData?
Another problem is the declaration of the query using the asterisk that is accepted
on JBoss:
[code] query = "SELECT COUNT(*) FROM SapUserData AS obj WHERE "[/code]
The EJBQL allows the usage of [code]COUNT(*)[/code] so far as I know.
So what's the point?
If it's standard compliant I would prefer the named query syntax that works on JBoss because I'm allowed to use the constants defined in the Interface of
the class. The constant named of that interface are used to declare the physical column names on the get methods of the fields using the @Column(..) annotation
so it would be very nice to be able to use them within the naemd query definitions.
If I have to do it the NetWeaver way I end up with hard coded strings for the field
names which is not so smart.
The fact I do not like at most is the fact that I'm unable to use base class fields in the query - I tried to change the field visibility form private to protected but I'm
still receiving the following exception:
[code]line 1: Path 'obj' (SapUserData) has no component 'timeSlice'
SELECT COUNT(obj.databaseId) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^[/code]
Any ideas on that?
Thanks in advance!
Henning Malzahn
Request clarification before answering.
Hi Henning!
Regarding your cross-platform development I would suggest that you firstly try to develop your application on our server which is strictly bound to the standard specifications. If you have it running on our Server there shouldn't be a problem to get it in a running state on JBoss which is not that strict and interprets the specs (at least in the JPA area) in a rather flexible way.
Best Regards,
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robin,
> Regarding your cross-platform development I would
> suggest that you firstly try to develop your
> application on our server which is strictly bound to
> the standard specifications. If you have it running
> on our Server there shouldn't be a problem to get it
> in a running state on JBoss
I definitely agree with that - but please note my previous post...
Henning
Hi Robin,
I changed the get method of the timeSlice field to use the same annotations used
for the get method of field dayOfAggregation - so it now looks like that:
[code] /**
Get method for the member "<code>timeSlice</code>".
@return Returns the timeSlice.
*/
@Embedded
@AttributeOverrides({@AttributeOverride(name = "timeSlice", /* Not possible to use interface constant here - field name must be used for reference */
column = @Column(name = TimeSliceContext.COLUMN_NAME_TIME_SLICE,
length = TimeSliceContext.TIME_SLICE_STR_LEN,
nullable = false)),
})
public TimeSlice getTimeslice() {
return this.timeSlice;
}[/code]
Unfortunately I'm still receiving the following exception:
[code]#
#1.5 #0007E97510B5000C0000015B00000E34005B19B7C7A831A4#1182520052397#com.sap.engine.services.orpersistence.query.QueryImpl#collogia.de/sapmonWorker#com.sap.engine.services.orpersistence.query.QueryImpl#Guest#0#SAP J2EE Engine JTA Transaction : [02720ffffff9a00336]####Thread[RMI/IIOP Worker [0],5,Dedicated_Application_Thread]##0#0#Error#1#/System/EnterpriseServices/ORPersistence#Plain###An error occurred processing the named query >>countQuerySapUserData<< with the query string >>SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice<<. #
#1.5 #0007E97510B5000C0000015C00000E34005B19B7C7A831A4#1182520052397#com.sap.engine.services.orpersistence.query.QueryImpl#collogia.de/sapmonWorker#com.sap.engine.services.orpersistence.query.QueryImpl#Guest#0#SAP J2EE Engine JTA Transaction : [02720ffffff9a00336]####Thread[RMI/IIOP Worker [0],5,Dedicated_Application_Thread]##0#0#Error##Java###caught java.lang.IllegalArgumentException: line 1: Comparison '=' not defined for dependent objects
SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^
line 1: Path 'obj' (SapUserData) has no component 'timeSlice'
SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^
[EXCEPTION]
#1#java.lang.IllegalArgumentException: line 1: Comparison '=' not defined for dependent objects
SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^
line 1: Path 'obj' (SapUserData) has no component 'timeSlice'
SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^
at com.sap.engine.lib.orpersistence.ejbqlparser.JPQLParserFacade.parseJQPL(JPQLParserFacade.java:30)
at com.sap.engine.services.orpersistence.query.QueryImpl.calculateJPQLQueryData(QueryImpl.java:102)
at com.sap.engine.services.orpersistence.query.QueryImpl.precompileQueries(QueryImpl.java:83)
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl$MetaDataImpl.<init>(EntityManagerFactoryImpl.java:153)
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl.getPersistenceUnitData(EntityManagerFactoryImpl.java:124)
at com.sap.engine.services.orpersistence.core.PersistenceContextImpl.<init>(PersistenceContextImpl.java:69)
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerImpl.<init>(EntityManagerImpl.java:71)
at com.sap.engine.services.orpersistence.entitymanager.JtaEntityManagerFactoryImpl.createEntityManagerInternal(JtaEntityManagerFactoryImpl.java:57)
at com.sap.engine.services.orpersistence.entitymanager.JtaEntityManagerFactoryImpl.createEntityManager(JtaEntityManagerFactoryImpl.java:49)
at com.sap.engine.services.orpersistence.container.EMManager.createEntityManager(EMManager.java:202)
at com.sap.engine.services.orpersistence.container.EMManager.getTransactionEntityManager(EMManager.java:60)
at com.sap.engine.services.orpersistence.container.EntityManagerProxy.getEntityManager(EntityManagerProxy.java:241)
at com.sap.engine.services.orpersistence.container.EntityManagerProxy.createNamedQuery(EntityManagerProxy.java:153)
at de.collogia.sapmon.worker.beans.service.user.SapCurrentUsersServiceBean.checkRecordExistence(SapCurrentUsersServiceBean.java:233)
at de.collogia.sapmon.worker.beans.service.user.SapCurrentUsersServiceBean.storeCurrentUserList(SapCurrentUsersServiceBean.java:109)
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:585)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:43)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext$InvocationContextImpl.proceed(AbstractInvocationContext.java:131)
at de.collogia.sapmon.worker.beans.interceptors.SapmonInterceptorLogServiceExecMethodStore.logServiceExecution(SapmonInterceptorLogServiceExecMethodStore.java:79)
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:585)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Application.invoke(Interceptors_Application.java:34)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:23)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:168)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceed(RequestInvocationContext.java:85)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at com.sap.engine.services.ejb3.runtime.impl.RemoteEJBProxyInvocationHandler.invoke(RemoteEJBProxyInvocationHandler.java:46)
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:585)
at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:237)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:253)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:109)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:841)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:125)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:59)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:168)[/code]
Henning
Hi Robin,
right after posting I was able to spot the problem:
The class TimeSlice previously was named Timeslice.
During the refactoring process I didn't notice that I had forgotten to rename the
get and set methods of class AbstractSapResultData - it still used the
version with the lower case s.
So the problem was that the class TimeSlice defined the correctly refactored get and set Methods
getTimeSlice and setTimeSlice and AbstractSapResultData still used
getTimeslice and setTimeslice.
After correcting that the exception stating
line 1: Path 'obj' (SapUserData) has no component 'timeSlice'disappeared.
So I'm left with the following exception:
#
#1.5 #0007E97510B5000B0000009400000E34005B19B7C7A7D7CA#1182521026906#System.err#collogia.de/sapmonWorker#System.err#Guest#0#SAP J2EE Engine JTA Transaction : [02720ffffff9a00367]####Thread[RMI/IIOP Worker [2],5,Dedicated_Application_Thread]##0#0#Error##Plain###Jun 22, 2007 4:03:46 PM de.collogia.sapmon.worker.beans.interceptors.SapmonInterceptorLogServiceExecMethodStore logServiceExecution
SEVERE: Exception raised from invocation of public void de.collogia.sapmon.worker.beans.service.user.SapCurrentUsersServiceBean.storeCurrentUserList(de.collogia.sapmon.configmgr.data.pojos.SapAccountShort,de.collogia.sapmon.configmgr.data.pojos.SapServerShort) throws de.collogia.sapmon.SapmonSapConnectivityException,de.collogia.sapmon.SapmonResultException,de.collogia.sapmon.SapmonServiceException method on bean instance de.collogia.sapmon.worker.beans.service.user.SapCurrentUsersServiceBean@24bf19 for bean collogia.de/sapmonWorker*annotation|sapmon-worker-0.1.0.jar*annotation|SapCurrentUsersServiceBean; nested exception is: java.lang.IllegalArgumentException: line 1: Comparison '=' not defined for dependent objects
SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
^
line 1: Comparison '=' not defined for dependent objects
SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation= :day_of_aggregation AND obj.timeSlice= :time_slice
Henning
Hello Robin,
you've been faster...
...and your guess was absolutely correct - The class has a startTime and endTime
field. And the query works like outlined in your post.
But the problem is that I don't want the fields startTime and endTime to become
persistent - so get methods of these fields shall be marked with @Transient.
I had to remove that annotation to get the query working and I also had to create
set methods for the two fields.
Any idea on solving that while keeping the fields transient?
Henning
Hello Robin,
>Regarding to the JPQL-grammer (spec 4.14) you are not allowed to compare
>with the non-terminal embeddable field
What document are you refering to exactly - Can you provide a resource link
for me?
After solving the issue with the TimeSlice class I'm having trouble with Day class
which is exactly the same issue as with the TimeSlice class but anyhow I'm not
able to figure out what's going wrong there.
The Day class contains a field named calendar used for internal storage.
I tried to use the same approach as for the TimeSlice class.
My SapUserData class has a field of Type Day called dayOfAggregation.
The query now looks like that:
@NamedQuery(name = SapUserDataContext.NAMED_QUERY_NAME_COUNT_QUERY,
query = "SELECT COUNT(obj) FROM SapUserData AS obj WHERE "
+ "obj.sapCustomerId"
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_CUSTOMER_ID
+ " AND "
+ "obj.sapSystemId"
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_SYSTEM_ID
+ " AND "
+ "obj.sapServerId"
+ "= :"
+ SapResultDataContext.COLUMN_NAME_SAP_SERVER_ID
+ " AND "
+ "obj.dayOfAggregation.calendar"
+ "= :"
+ DayContext.COLUMN_NAME_DAY_OF_AGGREGATION
+ " AND "
+ "obj.timeSlice.startTime"
+ "= :"
+ "timeSliceStartTime"
+ " AND "
+ "obj.timeSlice.endTime"
+ "= :"
+ "timeSliceEndTime"),So I'm using the same way to access the calendar field like I'm accessing the
startTime and endTime fields of class TimeSlice.
+ "obj.dayOfAggregation.calendar"
+ "= :"
+ DayContext.COLUMN_NAME_DAY_OF_AGGREGATIONDespite that fact NetWeaver still complains:
[EXCEPTION]
{0}#1#java.lang.IllegalArgumentException: line 1: Comparison '=' not defined for dependent objects
SELECT COUNT(obj) FROM SapUserData AS obj WHERE obj.sapCustomerId= :sap_customer_id AND obj.sapSystemId= :sap_system_id AND obj.sapServerId= :sap_server_id AND obj.dayOfAggregation.calendar= :day_of_aggregation AND obj.timeSlice.startTime= :timeSliceStartTime AND obj.timeSlice.endTime= :timeSliceEndTime
^The calendar field is of type Calendar - is there anything special about Calendar
objects?
I changed all named queries to be standard compliant and they do run prefectly
on both application servers - except the part of the
obj.dayOfAggregation.calendar
part in the query - It only runs on JBoss application server.
I have to admit that it might be a problem of not seeing the trees because of the forrest but I'm stuck on it and don't know what NetWeaver complains about
because it's the same thing as with the TimeSlice class.
Henning
Hi Henning!
>
[EXCEPTION]
> {0}#1#java.lang.IllegalArgumentException: line 1:
> Comparison '=' not defined for dependent objects
> ELECT COUNT(obj) FROM SapUserData AS obj WHERE
> obj.sapCustomerId= :sap_customer_id AND
> obj.sapSystemId= :sap_system_id AND obj.sapServerId=
> :sap_server_id AND obj.dayOfAggregation.calendar=
> :day_of_aggregation AND obj.timeSlice.startTime=
> :timeSliceStartTime AND obj.timeSlice.endTime=
> :timeSliceEndTime
>
> >
> The calendar field is of type Calendar - is there
> anything special about Calendar
> objects?
>
> I changed all named queries to be standard compliant
> and they do run prefectly
> on both application servers - except the part of the
>
>
>
obj.dayOfAggregation.calendar
>
> part in the query - It only runs on JBoss application
> server.
As far as I see it now we have an issue in the current version of the JPQL Parser regarding the comparison of single-persistent fields of type java.util.Calendar and input-parameters. I will work on a solution for this. As a workaround I recommend you to use Date and Time classes of the java.sql package for your entities and queries.
Regarding the specifation documents I suggest you to have a look at the following URL:
http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html
Best Regards,
Robin
Good Morning Robin,
thanks for the link to the spec. document.
To get you right - the problem is a bug?
If so it is a bug on the SAP NetWeaver server only, right?
I''m asking because the query runs on JBoss as mentioned above.
If that's the case I wait for a fix instead of re-designing my classes...
Henning
Hi Henning!
You're right, it is a bug and it is specific to Netweaver CE. I just tried to express it in a more positive way. Although it would only take a rather short time to fix the bug it might take a while until you get the version of Netweaver that contains this fix. As far as I know it will be contained in SAP NetWeaver Composition Environment 7.1 SP3 which will be generally available around the 3rd quarter 2007. I don't have any information if there will be a preview version available on SDN before that date. You should have this in mind when you decide on redesigning your classes or not.
Best Regards,
Robin
Hello Robin,
>I just tried to express it in a more positive way.
Ok - not the fact I wanted to hear but thanks for the honest answer.
Ugly enough to have two more columns in the db because of the TimeSlice class
and the startTime/ endTime problem - but I'm not going to rewrite my Day class.
I'l wait for the fixed version of the SAP NetWeaver.
I hope these things will be beautified in future JPA releases.
Thank you for your efforts!
Henning Malzahn
Hello Robin,
one question left.
Is it possible to figure out whether the fixed version will be available as preview.
This would be very nice because of the strict implementation of the SAP NetWeaver.
The other thing is that the title of my diploma work title includes:
"A unified implementation using EJB 3.0 for SAP NetWeaver and JBoss"...
... so it would be very nice to have the application up and running when
doing the final presentation for my professor...
Henning
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.