Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
bdlink
Post subject: [Closed]XDoclet ignoring merge directory? CMP finder methods  PostPosted: Feb 17, 2006 - 03:22 AM
Veteran Member
Veteran Member


Joined: Dec 11, 2005
Posts: 5

Trying to use XDoclet with MyEclipse, and so far it is a bit frustrating trying to find documentation. I am trying to add finder methods, and the generated ejb-jar.xml file says "<!-- Write a file named ejb-finders-StudentBean.xml if you want to define extra finders. -->". I assume extra means on top of findByPrimaryKey.

So I defined a directory merge, at the top level in the project, set the properties for MyEclipse-XDoclet>StandardEJB>ejbdoclet>mergeDir to merge. I added a ejb-finders-StudentBean.xml file with the following contents:
Code:
     <query>
       <query-method>
         <method-name>findByName</method-name>
         <method-params>
           <method-param>java.lang.String</method-param>
           <method-param>java.lang.String</method-param>
         </method-params>
       </query-method>
       <ejb-ql>
         SELECT OBJECT(s) FROM Student AS s
         WHERE s.lastName = ?1 AND s.firstName = ?2
       </ejb-ql>
     </query>
     <query>
       <query-method>
         <method-name>findByStudentNumber</method-name>
         <method-params>
           <method-param>java.lang.String</method-param>
         </method-params>
       </query-method>
       <ejb-ql>
         SELECT OBJECT(s) FROM Student AS s
         WHERE s.studentNumber = ?1
       </ejb-ql>
     </query>
     <query>
       <query-method>
         <method-name>findAll</method-name>
         <method-params/>
       </query-method>
       <ejb-ql>
         SELECT OBJECT(s) FROM Student AS s
       </ejb-ql>
     </query>

ran myeclipse>xdoclet and looked at the ejb-jar.xml file - no change from before, the query tags were ignored.

I have found lots of trivial CMP examples with no finder or select methods. relationship methods are somewhat intuitive as there are abstract methods in the bean class to add attributes for the generated stuff. Should I be adding something somewhere so the finder methods make it into the home interfaces?

Any help would be appreciated in terms of what I may be doing wrong, and where this is documented, so I can move on to the next steps.

Thanks
 
 View user's profile Send private message  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Feb 17, 2006 - 08:35 AM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23855

Quote:

Trying to use XDoclet with MyEclipse, and so far it is a bit frustrating trying to find documentation.

Just a tip, the XDoclet support in ME is just that, support for run-of-the-mill XDoclet. If you are googling for documentation, just looking normal XDoclet tutorials, they will all work fine in MyEclipse.

Quote:

So I defined a directory merge, at the top level in the project, set the properties for MyEclipse-XDoclet>StandardEJB>ejbdoclet>mergeDir to merge. I added a ejb-finders-StudentBean.xml file with the following contents:

Silly question, but your top level directory IS called merge correct? Did you try /merge as well?

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
bdlink
Post subject:   PostPosted: Feb 17, 2006 - 04:03 PM
Veteran Member
Veteran Member


Joined: Dec 11, 2005
Posts: 5

Yes, thank you, I started with the XDoclet site and found their documentation difficult to follow as well (I have previously done the descriptors by hand, and used ant to build, though I have also used JBOSS IDE and the old 1.3 sun reference deploytool - first time I am trying XDoclet). XDoclet seems to be assuming you are using ant directly to run your project, not MyEclipse. I have gone through the myeclipse tutorials, and have looked at the laliluna tutorials.

Yes, the merge directory is called merge. I tried /merge in the myeclipse-Xdoclet mergeDir params which did not result in the file being added to the ejb-jar.xml (no change), but thanks for the suggestion.

I am using J2EE 1.4 and EJB 2.1 spec if that makes a difference, the MyEclipse tutorials say that you need to use J2EE 1.3 with XDoclet, but the XDoclet people say it is fine with J2EE 1.4.
 
 View user's profile Send private message  
Reply with quote Back to top
support-greg
Post subject:   PostPosted: Feb 18, 2006 - 07:08 AM
Moderator
Moderator


Joined: Mar 31, 2004
Posts: 1615

Try setting the merge directory attribute on the ejbcmp subtask under ejbdoclet. See if that makes a difference. Note: I have not actually performed a successful merge by doing this, I'm just making a suggestion.

_________________
Greg
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
bdlink
Post subject:   PostPosted: Feb 18, 2006 - 08:03 PM
Veteran Member
Veteran Member


Joined: Dec 11, 2005
Posts: 5

OK,
I found the answer, I think. The comment in the ejb-jar.xml is misleading. What you have to do is use @ejb.finder at the bean class which then adds in the info. Probably XDoclet knows it does not make sense to merge the file so it silently ignores it?

In any case, I have figured out how to get it to add finder methods, so I am happy again.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits