Discussion:
[Middlegen-user] How to generate custom query method
D***@de.gi-de.com
2004-09-10 06:38:23 UTC
Permalink
Hi,

I`m trying to add a EJB query method to a Entity Bean (here for Table
"Card"), that counts the number of entries (here cards).
I have added the following "code"
/**
* @ejb.select
* result-type-mapping="Local"
* query="SELECT COUNT(*) FROM Card, WHERE State_Id = ?1"
*
**/
public abstract long countCards(long ErrorId);



in the file "cmp20-Card-class-comments.txt" within the merge directory.
Midlegen copies this code into the CardBean.java file, but xdoclet then
fails to execute (<<The Bean class is needed but not found in Xdoclet
source path for interface com.gd.ecard.dao.interfaces.CardLocal>>)

What am I doing wrong?
I would be grateful for any help.
Thanks.
Tim Cockle
2004-09-10 19:55:24 UTC
Permalink
Hi

It should be in cmp20-Card-class-code.txt

Tim
Post by D***@de.gi-de.com
Hi,
I`m trying to add a EJB query method to a Entity Bean (here for Table
"Card"), that counts the number of entries (here cards).
I have added the following "code"
/**
* result-type-mapping="Local"
* query="SELECT COUNT(*) FROM Card, WHERE State_Id = ?1"
*
**/
public abstract long countCards(long ErrorId);
in the file "cmp20-Card-class-comments.txt" within the merge
directory.
Midlegen copies this code into the CardBean.java file, but xdoclet
then fails to execute (<<The Bean class is needed but not found in
Xdoclet source path for interface
com.gd.ecard.dao.interfaces.CardLocal>>)
What am I doing wrong?
I would be grateful for any help.
Thanks.
D***@de.gi-de.com
2004-09-13 07:08:13 UTC
Permalink
Thanks for the help.
I had figured that out by now from an example. It still does not work
though. Xdoclet does not generate any interface method (but no Error is
reported).
Any clue?
Thanks.




Tim Cockle <***@ajbs-ltd.com>
Gesendet von: middlegen-user-***@lists.sourceforge.net
10.09.2004 10:46
Bitte antworten an middlegen-user

An: middlegen-***@lists.sourceforge.net
Kopie:
Thema: Re: [Middlegen-user] How to generate custom query method


Hi

It should be in cmp20-Card-class-code.txt

Tim
Post by D***@de.gi-de.com
Hi,
I`m trying to add a EJB query method to a Entity Bean (here for Table
"Card"), that counts the number of entries (here cards).
I have added the following "code"
/**
* result-type-mapping="Local"
* query="SELECT COUNT(*) FROM Card, WHERE State_Id = ?1"
*
**/
public abstract long countCards(long ErrorId);
in the file "cmp20-Card-class-comments.txt" within the merge
directory.
Midlegen copies this code into the CardBean.java file, but xdoclet
then fails to execute (<<The Bean class is needed but not found in
Xdoclet source path for interface
com.gd.ecard.dao.interfaces.CardLocal>>)
What am I doing wrong?
I would be grateful for any help.
Thanks.
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
M.-Leander Reimer
2004-09-13 07:42:17 UTC
Permalink
Hi Dietmar,

1. I think an EJB select method has to start with ejbSelect so tge
method name should be

public abstract long ejbSelectCountCards(long ErrorId);

2. You need a second method which you tag as @ejb.interface-method
view-type="local", that simply calls your EJB select method. This will
result in the method being present in your interface definition.

Hope this works.

Leander
Post by D***@de.gi-de.com
Thanks for the help.
I had figured that out by now from an example. It still does not work
though. Xdoclet does not generate any interface method (but no Error is
reported).
Any clue?
Thanks.
10.09.2004 10:46
Bitte antworten an middlegen-user
Thema: Re: [Middlegen-user] How to generate custom query
method
Hi
It should be in cmp20-Card-class-code.txt
Tim
Post by D***@de.gi-de.com
Hi,
I`m trying to add a EJB query method to a Entity Bean (here for Table
"Card"), that counts the number of entries (here cards).
I have added the following "code"
/**
* result-type-mapping="Local"
* query="SELECT COUNT(*) FROM Card, WHERE State_Id = ?1"
*
**/
public abstract long countCards(long ErrorId);
in the file "cmp20-Card-class-comments.txt" within the merge
directory.
Midlegen copies this code into the CardBean.java file, but xdoclet
then fails to execute (<<The Bean class is needed but not found in
Xdoclet source path for interface
com.gd.ecard.dao.interfaces.CardLocal>>)
What am I doing wrong?
I would be grateful for any help.
Thanks.
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
D***@de.gi-de.com
2004-09-13 10:20:03 UTC
Permalink
Yes, this was the solution. Thanks a lot.

The use of meta-information makes programming somehow a bit more
difficult. One has to mind how methods are named (something one needs to
get used to when coming from C++).

Nevertheless I find the use of these "Merge Files" a bit brittle (many
places where errors can be made). At least it would be a Help if the usage
were better documented.
This I guess should be addressed to the developers though.

Cheers and Thanks.

Loading...