wood burning stoves 2.0*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "CDATA in EJB-ql" Watch "CDATA in EJB-ql" New topic
Author

CDATA in EJB-ql

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
************************************************************
<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

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
author
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"
<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.


Elliotte Rusty Harold<br />Author of <a href="http://cafe.elharo.com/web/refactoring-html/" target="_blank" rel="nofollow">Refactoring HTML</a>
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

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


Groovy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CDATA in EJB-ql