File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes CDATA in EJB-ql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "CDATA in EJB-ql" Watch "CDATA in EJB-ql" New topic


manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
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
<![CDATA[WHERE (name = ?1) ORDERBY shortDescription]]>
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.

Serge Adzinets
Ranch Hand

Joined: Nov 26, 2002
Posts: 166
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.

Best Regards,<br />Serge
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
I'm moving this to the XML forum since it doesn't relate to any certifications.
Elliotte Rusty Harold
Ranch Hand

Joined: Feb 25, 2004
Posts: 91
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"
<![CDATA[WHERE (name = ?1) ORDERBY shortDescription]]>
is exactly equivalent to
WHERE (name = ?1) ORDERBY shortDescription
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.

Elliotte Rusty Harold<br />Author of <a href="" target="_blank" rel="nofollow">Refactoring HTML</a>
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

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

I agree. Here's the link:
subject: CDATA in EJB-ql
jQuery in Action, 3rd edition