Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

EJB-QL problem. max() statement.

843829Sep 8 2002 — edited Sep 9 2002
Hi.

I have a problem with ejb-ql statement.

I have entity-bean with finder findByShiftIdAndDate that consists:
select OBJECT(oshcd) from OsdShiftHourCorrection oshcd where oshcd.shiftIdFK = ?1 and (oshcd.year = (select max(oshcdy.year) from OsdShiftHourCorrection oshcdy where oshcdy.year<=?2))

When I deploy jar, I got next application error message:

2002-09-08 12:51:26,221 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.OsdShiftHourCorrection.findByShiftIdAndDate] EJB-QL: select OBJECT(oshcd) from OsdShiftHourCorrection oshcd where oshcd.shiftIdFK = ?1 and (oshcd.year = (select max(oshcdy.year) from OsdShiftHourCorrection oshcdy where oshcdy.year<=?2))
2002-09-08 12:51:26,251 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.parentTraceEnabled=true
2002-09-08 12:51:26,251 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.nestedTraceEnabled=true
2002-09-08 12:51:26,251 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.detectDuplicateNesting=true
2002-09-08 12:51:26,261 ERROR [org.jboss.ejb.EjbModule] Starting failed
org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "= ( select" at line 1, column 99.
Was expecting one of:
")" ...
"+" ...
"-" ...
"*" ...
"/" ...
"=" "+" ...
"=" "-" ...
"=" <NUMERIC_VALUED_PATH> ...
"=" <INTEGER_LITERAL> ...
"=" <FLOATING_POINT_LITERAL> ...
"=" "(" "+" ...
"=" "(" "-" ...
"=" "(" <NUMERIC_VALUED_PATH> ...
"=" "(" <INTEGER_LITERAL> ...
"=" "(" <FLOATING_POINT_LITERAL> ...
"=" "(" "(" ...
"=" "(" <NUMERIC_VALUED_PARAMETER> ...
"=" "(" "LENGTH" ...
"=" "(" "LOCATE" ...
"=" "(" "ABS" ...
"=" "(" "SQRT" ...
"=" <NUMERIC_VALUED_PARAMETER> ...
"=" "LENGTH" ...
"=" "LOCATE" ...
"=" "ABS" ...
"=" "SQRT" ...
"NOT" ...
"BETWEEN" ...
)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:46)
...

Does that means I can't use MAX() oracle function in my ejb-ql statements?

I've been tried to set

<function-mapping>
<function-name>max</function-name>
<function-sql>max(?1)</function-sql>
</function-mapping>


in my standardjbosscmp-jdbc.xml file

but a result is the same: error message still exists.

Would you so kind to clear up me what i have to do to solve my problem?

Thanks a lot for advice.

Regards, Scar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2002
Added on Sep 8 2002
1 comment
242 views