• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cmp finder method

 
alec stewart stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
i am not being able to understand what is wrong with my query

<query>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT Object(Story) FROM story AS Story WHERE Story.storyId = ?]]></ejb-ql>
</query>

it gives the follwing error on deployment:
org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement
'SELECT Object(Story) FROM story AS Story WHERE Story.storyId = ?'; - nested
throwable: (org.jboss.ejb.plugins.cmp.ejbql.TokenMgrError: Lexical error at line 1, col
umn 66. Encountered: <EOF> after : "")

if i use this then it works fine
<ejb-ql><![CDATA[SELECT Object(Story) FROM story AS Story WHERE Story.storyId = 6]]></ejb-ql>

but then it becomes hardcoded

PLease dear friends and seniors guide me on this i have been struggling on this from two days.

thanks
 
Marco Barenkamp
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

the questionmark must have an indexer.

Select Object(o) from customer o where o.name = ?1

?1 == first parameter
?2 == 2nd parameter

Rest looks fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic