Discussion:
[Middlegen-user] Use of #parse command for subset of database tables
Andy Marks
2002-10-01 04:30:01 UTC
Permalink
Hi All,

I'm using middlegen 1.0 to generate bean implementation files for all tables
in a database. I have _some_ custom
finder methods that I want to include in _some_ of the generated
<tableName>Bean.java files.

After looking at: http://boss.bekk.no/boss/middlegen/plugins/simple.html

I added the following line to my entity-cmp-20.vm:

#parse( "finders-${table.beanName}.vm" )

which, if I understand it, will include the contents of the file called
finders-<tableName>.vm into this position in the entity-cmp-20.vm template.

This seems to be attempting to do what I want because when I run middlegen,
I get the following error:

file:C:/andy/rev/dev/etc/build.xml:139: middlegen.MiddlegenException: Unable
to find resource 'finders-RevRmsConsign.vm'

which is 100% correct because there is no file called
finders-RevRmsConsign.vm.

HOWEVER, I only want to define these custom finder methods for a small
number of the tables in my database, so I've intentionally not created a
finders-RevRmsConsign.vm file because it's default finders are all I need.

So my question is: how do I enable the #parse functionality for a small
subset (i.e, 9 out of 32 tables) of my generated bean files.

I guess another way of asking the question is: is there anyway to ignore the
above errors when they are generated against files for which I have no need
for extra finders?

Thanks in advance
Regards,
Andy Marks

========================================================
Toll Transitions
Phone: (03) 8696 6076
Fax: (03) 8696 6001
Email: ***@toll.com.au
========================================================
www.tolltransitions.com.au <http://www.tolltransitions.com.au/> - Relocation
Redefined
Eivind Waaler
2002-10-01 05:09:04 UTC
Permalink
Hi Andy,

I would recommend downloading the latest release of Middlegen (2.0b) or
obtaining the cvs version.

The entity-cmp-20.vm allready contains merge points:
http://boss.bekk.no/boss/middlegen/plugins/cmp20.html (see bottom of page
or search for "merge")

See the middlegen samples for example usage, in samples/src/middlegen/ you
can see the different sample merge files.

I guess what you would want is something like the
cmp20-persons-class-comments.txt to add you custom finders (or in your
case cmp20-RevRmsConsign-class-comments.txt).

Hope this works for you.
.eivind
Post by Andy Marks
Hi All,
I'm using middlegen 1.0 to generate bean implementation files for all tables
in a database. I have _some_ custom
finder methods that I want to include in _some_ of the generated
<tableName>Bean.java files.
After looking at: http://boss.bekk.no/boss/middlegen/plugins/simple.html
#parse( "finders-${table.beanName}.vm" )
which, if I understand it, will include the contents of the file called
finders-<tableName>.vm into this position in the entity-cmp-20.vm template.
This seems to be attempting to do what I want because when I run middlegen,
file:C:/andy/rev/dev/etc/build.xml:139: middlegen.MiddlegenException: Unable
to find resource 'finders-RevRmsConsign.vm'
which is 100% correct because there is no file called
finders-RevRmsConsign.vm.
HOWEVER, I only want to define these custom finder methods for a small
number of the tables in my database, so I've intentionally not created a
finders-RevRmsConsign.vm file because it's default finders are all I need.
So my question is: how do I enable the #parse functionality for a small
subset (i.e, 9 out of 32 tables) of my generated bean files.
I guess another way of asking the question is: is there anyway to ignore the
above errors when they are generated against files for which I have no need
for extra finders?
Thanks in advance
Regards,
Andy Marks
========================================================
Toll Transitions
Phone: (03) 8696 6076
Fax: (03) 8696 6001
========================================================
www.tolltransitions.com.au <http://www.tolltransitions.com.au/> - Relocation
Redefined
-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server
today at http://www.ServePath.com/indexfm.htm
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Aslak Hellesøy
2002-10-01 05:26:01 UTC
Permalink
-----Original Message-----
Marks
Sent: 1. oktober 2002 08:34
Subject: [Middlegen-user] Use of #parse command for subset of database
tables
Hi All,
I'm using middlegen 1.0 to generate bean implementation files for
Erm, you're on 2.0-b1 it seems. -Or a CVS version of 2.0 before we chose to
call it 2.0.
all tables
in a database. I have _some_ custom
finder methods that I want to include in _some_ of the generated
<tableName>Bean.java files.
Then you're making life more complicated than it is. There are already merge
points for this. Take a peek at the bottom of:
http://boss.bekk.no/boss/middlegen/plugins/cmp20.html

Put your finder tags in pluginname-tablename-class-comments.txt

The airline sample also illustrates how to add custom finders.
After looking at: http://boss.bekk.no/boss/middlegen/plugins/simple.html
#parse( "finders-${table.beanName}.vm" )
which, if I understand it, will include the contents of the file called
finders-<tableName>.vm into this position in the entity-cmp-20.vm
template.
This seems to be attempting to do what I want because when I run
middlegen,
middlegen.MiddlegenException: Unable
to find resource 'finders-RevRmsConsign.vm'
which is 100% correct because there is no file called
finders-RevRmsConsign.vm.
HOWEVER, I only want to define these custom finder methods for a small
number of the tables in my database, so I've intentionally not created a
finders-RevRmsConsign.vm file because it's default finders are
all I need.
So my question is: how do I enable the #parse functionality for a small
subset (i.e, 9 out of 32 tables) of my generated bean files.
The above answer should solve your problem, but in short, use a $variable in
the #parse directive.
You can see how it's done in entity-cmp-20.vm. It already has a couple of
#parse directives which I think
you haven't spotted.
I guess another way of asking the question is: is there anyway to
ignore the
above errors when they are generated against files for which I
have no need
for extra finders?
Thanks in advance
Regards,
Andy Marks
Cheers,
Aslak
========================================================
Toll Transitions
Phone: (03) 8696 6076
Fax: (03) 8696 6001
========================================================
www.tolltransitions.com.au <http://www.tolltransitions.com.au/> -
Relocation
Redefined
-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server
today at http://www.ServePath.com/indexfm.htm
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Aslak Hellesøy
2002-10-01 05:30:02 UTC
Permalink
I saw Eivind's answer and realised you're probably on a CVS from before
these merge points were added.
-So my comments don't apply until you follow his advice about upgrading ;-)

Aslak
-----Original Message-----
Hellesøy
Sent: 1. oktober 2002 09:24
Subject: RE: [Middlegen-user] Use of #parse command for subset of
database tables
-----Original Message-----
Marks
Sent: 1. oktober 2002 08:34
Subject: [Middlegen-user] Use of #parse command for subset of database
tables
Hi All,
I'm using middlegen 1.0 to generate bean implementation files for
Erm, you're on 2.0-b1 it seems. -Or a CVS version of 2.0 before
we chose to
call it 2.0.
all tables
in a database. I have _some_ custom
finder methods that I want to include in _some_ of the generated
<tableName>Bean.java files.
Then you're making life more complicated than it is. There are
already merge
http://boss.bekk.no/boss/middlegen/plugins/cmp20.html
Put your finder tags in pluginname-tablename-class-comments.txt
The airline sample also illustrates how to add custom finders.
After looking at: http://boss.bekk.no/boss/middlegen/plugins/simple.html
#parse( "finders-${table.beanName}.vm" )
which, if I understand it, will include the contents of the file called
finders-<tableName>.vm into this position in the entity-cmp-20.vm
template.
This seems to be attempting to do what I want because when I run
middlegen,
middlegen.MiddlegenException: Unable
to find resource 'finders-RevRmsConsign.vm'
which is 100% correct because there is no file called
finders-RevRmsConsign.vm.
HOWEVER, I only want to define these custom finder methods for a small
number of the tables in my database, so I've intentionally not created a
finders-RevRmsConsign.vm file because it's default finders are
all I need.
So my question is: how do I enable the #parse functionality for a small
subset (i.e, 9 out of 32 tables) of my generated bean files.
The above answer should solve your problem, but in short, use a
$variable in
the #parse directive.
You can see how it's done in entity-cmp-20.vm. It already has a couple of
#parse directives which I think
you haven't spotted.
I guess another way of asking the question is: is there anyway to
ignore the
above errors when they are generated against files for which I
have no need
for extra finders?
Thanks in advance
Regards,
Andy Marks
Cheers,
Aslak
========================================================
Toll Transitions
Phone: (03) 8696 6076
Fax: (03) 8696 6001
========================================================
www.tolltransitions.com.au <http://www.tolltransitions.com.au/> -
Relocation
Redefined
-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server
today at http://www.ServePath.com/indexfm.htm
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server
today at http://www.ServePath.com/indexfm.htm
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...