Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CDATA in EJB-ql

 
manish ahuja
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Weblogic Guys
Can you explain this.
I was going through teh DD of 1 runnign application
where i found this entry for EJB-QL
************************************************************
<ejb-ql>
<![CDATA[WHERE (name = ?1) ORDERBY shortDescription]]>
</ejb-ql>
************************************************************
Is this a valid entry . Since it works i reckon yes.
In ohter containers i see the whole select statement(select object(m) from ......) being used what is this
CDATA stuff in Weblogic.
Could some one explain me what does CDATA translate into.

rgrds
 
Serge Adzinets
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Manish,
AFAIK, CDATA is used when you need to specify special characters in a tag of an XML file. I guess this ejb-ql is incorrect as it misses "select ... from ..." statement.
Also, ORDER BY is not a part of EJB 2.0 spec, though WL may still support it, I don't know.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this to the XML forum since it doesn't relate to any certifications.
 
Elliotte Rusty Harold
author
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CDATA sections are pure syntax sugar, nothing more. This is discussed in Item 15 of of Effective XML, "Build on top of structures, not syntax"
<ejb-ql>
<![CDATA[WHERE (name = ?1) ORDERBY shortDescription]]>
</ejb-ql>
is exactly equivalent to
<ejb-ql>
WHERE (name = ?1) ORDERBY shortDescription
</ejb-ql>
In this case the CDATA section was completely pointless. However, in the general case it might be used to let authors include < and & characters without escaping them. I suspect some tool here is simply wrapping all SQL queries in CDATA sections rather than take the time to figure out which if any characters need to be escaped. That's all.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, ORDER BY is not a part of EJB 2.0 spec, though WL may still support it, I don't know

It is supported in EJB 2.1
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic