Advertisement
I am using MyEclipse w/ XDoclets to create a CMP Entity bean.
The ejbdoclet tag that I am using looks like this:
@ejb.finder
signature="Collection findByUsername(String username)"
query="SELECT OBJECT(o) FROM membership AS o WHERE o.username = ?1"
After running XDoclet the following code snippet is created in the deployment descriptor:
<query>
<query-method>
<method-name>findByUsername</method-name>
<method-params>
<method-param>String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(o) FROM Membership AS o WHERE o.username = ?1]]></ejb-ql>
</query>
when I try to deploy this been I get the following message from JBoss 3.2.x...
20:54:30,978 WARN [verifier] EJB spec violation:
Bean : Membership
Method : public abstract Collection findByUsername(String) throws FinderException, RemoteException
Section: 10.5.6
Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.
Any one has any clues to why I have this problem?
Burton
The ejbdoclet tag that I am using looks like this:
@ejb.finder
signature="Collection findByUsername(String username)"
query="SELECT OBJECT(o) FROM membership AS o WHERE o.username = ?1"
After running XDoclet the following code snippet is created in the deployment descriptor:
<query>
<query-method>
<method-name>findByUsername</method-name>
<method-params>
<method-param>String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(o) FROM Membership AS o WHERE o.username = ?1]]></ejb-ql>
</query>
when I try to deploy this been I get the following message from JBoss 3.2.x...
20:54:30,978 WARN [verifier] EJB spec violation:
Bean : Membership
Method : public abstract Collection findByUsername(String) throws FinderException, RemoteException
Section: 10.5.6
Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.
Any one has any clues to why I have this problem?
Burton
Advertisement
Advertisement
-
Unsu...
Re: EJB/XDoclet Help
Sun, December 26, 2004 - 3:26 AMIts been forever since i've written ejb's, but i'll take a shot in the dark here:
Unless you are you trying to create a super-class that all EJB's in your project must extend, im thinking the fact that the signature for your finder method declares it as "abstract" would be one problem.
Hopefully someone with more experience with ejb can confirm this.
Also, if i recall correctly, you said you were just learning j2ee?
When i was first learning ejb/servlets i had tons of problems and confusion (of the "who's on first" nature) with xml configs and deploying my apps.
For example, on windows i found that javac sometimes decides it wont overwrite existing .class files even if then version being compiled is newer. I would end up with old .class files being added to the most recent ejb-jar or war file, at times having methods not matching the deployment descriptor, or deployment descriptors declaring methods that didnt exist, etc. I'm paranoid now so i write my build.xml files so that the "compile" and "dist" targets depend on the "clean" target.
The other problem that had me chasing my tail forever is that loggers for app servers/servlet containers do a crappy job of informing you of syntax errors or invalid markup in your xml configs. To double check i started using an XML validator to check my my xml configs against their respective DTD's.
Hope that helps. -
-
Re: EJB/XDoclet Help
Sun, December 26, 2004 - 4:42 PMI don't think that the the abstract finder method is probably being created by the container, since there isn't any declaration for an abstract class in my code. Secondly, I understand the problems with configurations and ejbs. They are a pain in the you know where (I think that probably most j2ee is like this). If you make a tiny mistake in one configuration file, it can take a while to figure out why your ejb won't deploy. To avoid this problem, I used xdoclets which should create the proper dd files and Home/Local-Home files for you.
Burton
-
Re: EJB/XDoclet Help
Sun, December 26, 2004 - 4:45 PMThanks for the help.
Burton
-
-
Re: EJB/XDoclet Help
Wed, December 29, 2004 - 6:16 AMThis is some real velveeta spread. I did a similiar project using BEA Workshop. When I tried to deploy to Workshop, I got a message basically telling me that I needed to use the exact class name ( java.lang.String ) instead of the short name (String).
So this works perfectly fine.
@ejb.finder
signature="Collection findByUsername(java.lang.String username)"
query="SELECT OBJECT(o) FROM membership AS o WHERE o.username = ?1"
That was pure cheese.... -
-
Re: EJB/XDoclet Help
Fri, December 31, 2004 - 4:31 PMhibernate is better...ejb(entity beans) is on it's way out...
-