- This topic has 3 replies, 2 voices, and was last updated 20 years, 4 months ago by Greg.
-
AuthorPosts
-
gzhuyeMemberI write finder and select tags in Bean class file(GoupBean.java) as following:
* @ejb.finder
* signature=”GroupBeanLocal findByGroupName(String name)”
* query=”SELECT OBJECT(g) FROM GroupBean g WHERE g.name = ?1″
*
*
* @ejb.select
* signature=”java.util.Collection ejbSelectUserIDs(java.lang.String groupName)”
* query=”SELECT user.email FROM GroupBean AS g, IN (g.users) AS user WHERE g.name = ?1″
*The abstract select method and it’s calling method located in the same bean file:
/**
* @param groupName
* @return
* @throws FinderException
*/
public abstract java.util.Collection ejbSelectUserIDs(java.lang.String groupName)
throws FinderException;/**
* @ejb.interface-method
*
* @return
* @throws javax.ejb.FinderException
*/
public String [] getUserIDs()throws javax.ejb.FinderException{
Collection c = this.ejbSelectUserIDs(this.getName());
return (String []) c.toArray(new String[c.size()]);
}However, after I generate the files by XDoclet, EJB-QL statement with @ejb.select tag can’t be writen to <ejb-ql> tag in ejb-jar.xml file, the tag <ejb-ql> for select has no any content:
<query>
<query-method>
<method-name>findByGroupName</method-name>
<method-params>
<method-param>String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(g) FROM GroupBean g WHERE g.name = ?1]]></ejb-ql>
</query>
<query>
<description><![CDATA[]]></description>
<query-method>
<method-name>ejbSelectUserIDs</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[]]></ejb-ql>As above, it’s ok with @ejb.finder tag, and this problem exists only with @ejb.select tag.
The other issue: is it “.” or “:” for @ejb tag like: @ejb.bean or @ejb:bean? The files generated by MyEclipse is like @ejb.bean; in XDoclet document, it is @ejb:bean. same thing with them?
Thanks in advance.
Paul
GregMemberPaul,
@ejb.finder tags are class level tags, so they go in the javadoc section for the class. You have this correct. However, @ejb.select tags are method-level tags, so you should put them in the javadoc of the ejbSelect method itself, like the following:
/** @ejb.select * query="SELECT a.street FROM Address AS a WHERE a.street = 'Cinnamon Street'" */ public abstract String ejbSelectMostCrowdedStreet() throws FinderException;
gzhuyeMemberYou’re right, it works ! Thank you very very much ! — lovely MyEclipse Group!
The other issue: is it “.” or “:” for @ejb tag like: @ejb.bean or @ejb:bean? The files generated by MyEclipse is like @ejb.bean; in XDoclet document, it is @ejb:bean. same thing with them?
GregMemberOops, I meant to answer that question as well 🙂 I believe this syntax is interchangable as far as xdoclet is concerned. The code-assist will always place a ‘.’ no matter if a ‘:’ or ‘.’ is being used when the code-assist is invoked(Ctrl+space).
-
AuthorPosts