Discussion:
[Middlegen-user] Request for help with new adapter/struts/hibernate
Andreas Kemkes
2004-03-01 16:59:05 UTC
Permalink
I'm trying to use the new adapter/struts/hibernate plugins from CVS and
do have two problems, which I can't seem to pin down:

(1) ${persistenceClass} is left in the Struts*Delegate.java files. How
can I correct the issue? My middlegen adapter plugin is called from
ant's middlegen target with the following settings:

<adapter destination="${project.gen-src.dir}"
package="${project.name}.adapter"
persistenceLayerName="hibernate"
actionLayerName="struts"/>

(2) This is probably unrelated, but even though it doesn't happen in the
samples case of the middlegen distribution, I can't get rid of it in my
own project:

[webdoclet] 2004-03-01 10:27:30,140
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- name=setEngine
[webdoclet] 2004-03-01 10:27:30,140
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- propertyName=engine
[webdoclet] 2004-03-01 10:27:30,140
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- capitalPropertyName=Engine
[webdoclet] 2004-03-01 10:27:30,156
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- InvocationTargetException
[webdoclet] java.lang.reflect.InvocationTargetException
[webdoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[webdoclet] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[webdoclet] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[webdoclet] at java.lang.reflect.Method.invoke(Method.java:324)
[webdoclet] at
xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor(ConfigParamIntrospector.java:187)
[webdoclet] at
xdoclet.ConfigParamIntrospector.fillConfigParamsFor(ConfigParamIntrospector.java:113)
[webdoclet] at xdoclet.DocletTask.getConfigParams(DocletTask.java:439)
[webdoclet] at xdoclet.DocletTask.createContext(DocletTask.java:611)
[webdoclet] at xdoclet.DocletTask.validateSubTasks(DocletTask.java:513)
[webdoclet] at xdoclet.DocletTask.validateOptions(DocletTask.java:487)
[webdoclet] at
xdoclet.modules.web.WebDocletTask.validateOptions(WebDocletTask.java:21)
[webdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:80)
[webdoclet] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
[webdoclet] at org.apache.tools.ant.Task.perform(Task.java:401)
[webdoclet] at org.apache.tools.ant.Target.execute(Target.java:338)
[webdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:365)
[webdoclet] at
org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[webdoclet] at
org.apache.tools.ant.Project.executeTargets(Project.java:1094)
[webdoclet] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[webdoclet] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[webdoclet] at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[webdoclet] at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
[webdoclet] Caused by: java.lang.IllegalStateException: Engine is null?!
[webdoclet] at
xdoclet.TemplateSubTask.getEngine(TemplateSubTask.java:172)
[webdoclet] ... 22 more

My webdoclet target calls webdoclet like this:

<webdoclet destdir="${project.web-inf.dir}"
excludedtags="@version,@author"
verbose="true">
<fileset dir="${project.gen-src.dir}">
<include name="**/web/**/*.java" />
</fileset>

<deploymentdescriptor
servletspec="2.3"
validatexml="true"
mergedir="${project.src.dir}/xdoclet"/>
<strutsconfigxml
destdir="${project.web-inf.dir}">
<configParam name="version" value="1.0"/>
</strutsconfigxml>
</webdoclet>

Any hints on what I'm missing are much appreciated.

Andreas
Eivind Waaler
2004-03-01 17:57:11 UTC
Permalink
Hi Andreas,

The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.

Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.

Regards
.eivind
Post by Andreas Kemkes
I'm trying to use the new adapter/struts/hibernate plugins from CVS and
(1) ${persistenceClass} is left in the Struts*Delegate.java files. How
can I correct the issue? My middlegen adapter plugin is called from
<adapter destination="${project.gen-src.dir}"
package="${project.name}.adapter"
persistenceLayerName="hibernate"
actionLayerName="struts"/>
(2) This is probably unrelated, but even though it doesn't happen in the
samples case of the middlegen distribution, I can't get rid of it in my
[webdoclet] 2004-03-01 10:27:30,140
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- name=setEngine
[webdoclet] 2004-03-01 10:27:30,140
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- propertyName=engine
[webdoclet] 2004-03-01 10:27:30,140
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- capitalPropertyName=Engine
[webdoclet] 2004-03-01 10:27:30,156
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor)
- InvocationTargetException
[webdoclet] java.lang.reflect.InvocationTargetException
[webdoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[webdoclet] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[webdoclet] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[webdoclet] at java.lang.reflect.Method.invoke(Method.java:324)
[webdoclet] at
xdoclet.ConfigParamIntrospector.fillConfigParamsHashMapUsingReflectionFor(ConfigParamIntrospector.java:187)
[webdoclet] at
xdoclet.ConfigParamIntrospector.fillConfigParamsFor(ConfigParamIntrospector.java:113)
[webdoclet] at xdoclet.DocletTask.getConfigParams(DocletTask.java:439)
[webdoclet] at xdoclet.DocletTask.createContext(DocletTask.java:611)
[webdoclet] at xdoclet.DocletTask.validateSubTasks(DocletTask.java:513)
[webdoclet] at xdoclet.DocletTask.validateOptions(DocletTask.java:487)
[webdoclet] at
xdoclet.modules.web.WebDocletTask.validateOptions(WebDocletTask.java:21)
[webdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:80)
[webdoclet] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
[webdoclet] at org.apache.tools.ant.Task.perform(Task.java:401)
[webdoclet] at org.apache.tools.ant.Target.execute(Target.java:338)
[webdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:365)
[webdoclet] at
org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[webdoclet] at
org.apache.tools.ant.Project.executeTargets(Project.java:1094)
[webdoclet] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[webdoclet] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[webdoclet] at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[webdoclet] at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
[webdoclet] Caused by: java.lang.IllegalStateException: Engine is null?!
[webdoclet] at
xdoclet.TemplateSubTask.getEngine(TemplateSubTask.java:172)
[webdoclet] ... 22 more
<webdoclet destdir="${project.web-inf.dir}"
verbose="true">
<fileset dir="${project.gen-src.dir}">
<include name="**/web/**/*.java" />
</fileset>
<deploymentdescriptor
servletspec="2.3"
validatexml="true"
mergedir="${project.src.dir}/xdoclet"/>
<strutsconfigxml
destdir="${project.web-inf.dir}">
<configParam name="version" value="1.0"/>
</strutsconfigxml>
</webdoclet>
Any hints on what I'm missing are much appreciated.
Andreas
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Andreas Kemkes
2004-03-01 19:08:11 UTC
Permalink
Post by Eivind Waaler
Hi Andreas,
The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.
I do understand that it is work in progress. It was just too tempting
to see that something is in progress to decouple struts and cmp20. And
there aren't any composite keys in my model right now.

I've looked a bit deeper and it seems that velocity's #parse directive
appears ineffective. This is supposed to work, isn't it. I'm using a
velocity 1.4 jar file. Any ideas what could be the cause?

Thanks,

Andreas
Post by Eivind Waaler
Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.
Regards
.eivind
Eivind Waaler
2004-03-02 07:28:01 UTC
Permalink
Post by Andreas Kemkes
Post by Eivind Waaler
Hi Andreas,
The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.
I do understand that it is work in progress. It was just too tempting
to see that something is in progress to decouple struts and cmp20. And
there aren't any composite keys in my model right now.
It's nice to see that there's interest in this work :-) When running it on
the three sample tables (flight, person, reservation) i only get an error
on the StrutsReservationDelegate because of the composite key. Have you
tried this? Just to check if it's related to your setup or the tables
you're using.
Post by Andreas Kemkes
I've looked a bit deeper and it seems that velocity's #parse directive
appears ineffective. This is supposed to work, isn't it. I'm using a
velocity 1.4 jar file. Any ideas what could be the cause?
It is supposed to work, but I haven't had time to test it through very
well yet. Not sure what could cause your problem. Let me know if you
figure out anything or do any more development on this, I'd be happy to
update the cvs. The goal is to get a first version of this up and running
asap, seems to be something people might be finding useful.

Cheers
.eivind
Post by Andreas Kemkes
Thanks,
Andreas
Post by Eivind Waaler
Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.
Regards
.eivind
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
James Neville
2004-03-02 09:39:06 UTC
Permalink
All,

I'm new to the list; been having a browse on the SF archive, trying to get a better handle on where this project is going..

We've just been trying out Middlegen for Hibernate mapping generation ---> VO generation.
Its working great, and its temping me to ditch a proprietary persistence architecture and replace it with Hibernate (this project is also doing v well-IMHO)!

Now i'm hearing some noises about Struts framework generation via Middlegen (ie this msg); I can only seem to gen EJB's from it, and the documentation is falling rather short.... this is about all I know how to do in an ant task:-

<target
name="middlegen-struts"
description="Run Middlegen Struts Generator"
unless="middlegen.skip"
depends="prepare">

<taskdef name="middlegen" classname="middlegen.MiddlegenTask" classpathref="project.class.path"/>

<middlegen
appname="${app.name}"
prefsdir="${rsrc.dir}"
gui="true"
databaseurl="${database.url}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}">
<struts
destination="${build.dir}"
package="com.bb.struts"
<jsp destination="${build.dir}/jsp" />
</struts>
</middlegen>
</target>

Is this the current state of development in CVS, or is there more we can test out? Anyone have any doco?:)
If not, does anyone have any suggestions for automating generation of a Struts application framework?

Thanks for any thoughts, and apologies for all the questions ;)

James.
Andreas Kemkes
2004-03-02 15:25:11 UTC
Permalink
Eivind:

It'll definitely be useful :-). Thanks for the work In the meantime a
quick test with the airline example didn't show any different results,
still the #parse substitution issue.

Maybe I need to start over with the full cvs version. I only compiled
the adapter and struts plugin from cvs and replaced the libraries in the
last distribution. Maybe that's what causes the problem, even though it
doesn't make sense to me.

Also, I made a separate test with velocity and the #parse substitution
appears to work.

Looks like a rather trivial problem, once it's tracked down ;-).

Andreas
Post by Eivind Waaler
Post by Andreas Kemkes
Post by Eivind Waaler
Hi Andreas,
The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.
I do understand that it is work in progress. It was just too tempting
to see that something is in progress to decouple struts and cmp20. And
there aren't any composite keys in my model right now.
It's nice to see that there's interest in this work :-) When running it on
the three sample tables (flight, person, reservation) i only get an error
on the StrutsReservationDelegate because of the composite key. Have you
tried this? Just to check if it's related to your setup or the tables
you're using.
Post by Andreas Kemkes
I've looked a bit deeper and it seems that velocity's #parse directive
appears ineffective. This is supposed to work, isn't it. I'm using a
velocity 1.4 jar file. Any ideas what could be the cause?
It is supposed to work, but I haven't had time to test it through very
well yet. Not sure what could cause your problem. Let me know if you
figure out anything or do any more development on this, I'd be happy to
update the cvs. The goal is to get a first version of this up and running
asap, seems to be something people might be finding useful.
Cheers
.eivind
Post by Andreas Kemkes
Thanks,
Andreas
Post by Eivind Waaler
Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.
Regards
.eivind
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Eivind Waaler
2004-03-02 16:08:02 UTC
Permalink
Ah, I think I know what it is. The adapter plugin also needs some changes
to the main middlegen class files:

http://jira.codehaus.org/secure/ViewIssue.jspa?key=MIDDLEGEN-11

If you build middlegen with all plugins from cvs it should work, as you
suggested :-)

If you find problems or have suggestions/changes I would appreciate if you
logged them in our jira bug tracker:

http://jira.codehaus.org/secure/BrowseProject.jspa?id=10110

.eivind
Post by Andreas Kemkes
It'll definitely be useful :-). Thanks for the work In the meantime a
quick test with the airline example didn't show any different results,
still the #parse substitution issue.
Maybe I need to start over with the full cvs version. I only compiled
the adapter and struts plugin from cvs and replaced the libraries in the
last distribution. Maybe that's what causes the problem, even though it
doesn't make sense to me.
Also, I made a separate test with velocity and the #parse substitution
appears to work.
Looks like a rather trivial problem, once it's tracked down ;-).
Andreas
Post by Eivind Waaler
Post by Andreas Kemkes
Post by Eivind Waaler
Hi Andreas,
The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.
I do understand that it is work in progress. It was just too tempting
to see that something is in progress to decouple struts and cmp20. And
there aren't any composite keys in my model right now.
It's nice to see that there's interest in this work :-) When running it on
the three sample tables (flight, person, reservation) i only get an error
on the StrutsReservationDelegate because of the composite key. Have you
tried this? Just to check if it's related to your setup or the tables
you're using.
Post by Andreas Kemkes
I've looked a bit deeper and it seems that velocity's #parse directive
appears ineffective. This is supposed to work, isn't it. I'm using a
velocity 1.4 jar file. Any ideas what could be the cause?
It is supposed to work, but I haven't had time to test it through very
well yet. Not sure what could cause your problem. Let me know if you
figure out anything or do any more development on this, I'd be happy to
update the cvs. The goal is to get a first version of this up and running
asap, seems to be something people might be finding useful.
Cheers
.eivind
Post by Andreas Kemkes
Thanks,
Andreas
Post by Eivind Waaler
Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.
Regards
.eivind
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Andreas Kemkes
2004-03-02 16:28:06 UTC
Permalink
Eivind:

Good to know. I'm currently having problems with the cvs access, which
keeps giving me i/o exceptions: no response from server. Maybe I need
to wait a little.
.
I'll report problems, when I run into them.

Andreas
Post by Eivind Waaler
Ah, I think I know what it is. The adapter plugin also needs some changes
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MIDDLEGEN-11
If you build middlegen with all plugins from cvs it should work, as you
suggested :-)
If you find problems or have suggestions/changes I would appreciate if you
http://jira.codehaus.org/secure/BrowseProject.jspa?id=10110
.eivind
Post by Andreas Kemkes
It'll definitely be useful :-). Thanks for the work In the meantime a
quick test with the airline example didn't show any different results,
still the #parse substitution issue.
Maybe I need to start over with the full cvs version. I only compiled
the adapter and struts plugin from cvs and replaced the libraries in the
last distribution. Maybe that's what causes the problem, even though it
doesn't make sense to me.
Also, I made a separate test with velocity and the #parse substitution
appears to work.
Looks like a rather trivial problem, once it's tracked down ;-).
Andreas
Post by Eivind Waaler
Post by Andreas Kemkes
Post by Eivind Waaler
Hi Andreas,
The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.
I do understand that it is work in progress. It was just too tempting
to see that something is in progress to decouple struts and cmp20. And
there aren't any composite keys in my model right now.
It's nice to see that there's interest in this work :-) When running it on
the three sample tables (flight, person, reservation) i only get an error
on the StrutsReservationDelegate because of the composite key. Have you
tried this? Just to check if it's related to your setup or the tables
you're using.
Post by Andreas Kemkes
I've looked a bit deeper and it seems that velocity's #parse directive
appears ineffective. This is supposed to work, isn't it. I'm using a
velocity 1.4 jar file. Any ideas what could be the cause?
It is supposed to work, but I haven't had time to test it through very
well yet. Not sure what could cause your problem. Let me know if you
figure out anything or do any more development on this, I'd be happy to
update the cvs. The goal is to get a first version of this up and running
asap, seems to be something people might be finding useful.
Cheers
.eivind
Post by Andreas Kemkes
Thanks,
Andreas
Post by Eivind Waaler
Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.
Regards
.eivind
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Andreas Kemkes
2004-03-02 18:01:14 UTC
Permalink
Eivind:

I haven't gotton around to analyze it in detail, but the generated code
looks much better, i.e. the #parse issue is gone. In fact the only thing
I noticed was the following dependency on the airline example in the
*Delegate.java code:

net.sf.hibernate.SessionFactory factory =
(net.sf.hibernate.SessionFactory)ctx.lookup("AirlineHibernateFactory");

I know it's work in progress, but I thought you may want to know.

Also, in delegate.vm, there is the following definition of useVO:

#set( $useVO = $plugin.voPrefix && $plugin.voSuffix )

Wouldn't it be sufficient to use || instead of && and relax the
requirement to specify both voPrefix and voSuffix to either of them.

I'm not familiar with JIRA yet. I'll try to look into it and will
report further comments there.

Thanks for getting me on the right track.

Regards,

Andreas
Post by Eivind Waaler
Ah, I think I know what it is. The adapter plugin also needs some changes
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MIDDLEGEN-11
If you build middlegen with all plugins from cvs it should work, as you
suggested :-)
If you find problems or have suggestions/changes I would appreciate if you
http://jira.codehaus.org/secure/BrowseProject.jspa?id=10110
.eivind
Post by Andreas Kemkes
It'll definitely be useful :-). Thanks for the work In the meantime a
quick test with the airline example didn't show any different results,
still the #parse substitution issue.
Maybe I need to start over with the full cvs version. I only compiled
the adapter and struts plugin from cvs and replaced the libraries in the
last distribution. Maybe that's what causes the problem, even though it
doesn't make sense to me.
Also, I made a separate test with velocity and the #parse substitution
appears to work.
Looks like a rather trivial problem, once it's tracked down ;-).
Andreas
Post by Eivind Waaler
Post by Andreas Kemkes
Post by Eivind Waaler
Hi Andreas,
The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.
I do understand that it is work in progress. It was just too tempting
to see that something is in progress to decouple struts and cmp20. And
there aren't any composite keys in my model right now.
It's nice to see that there's interest in this work :-) When running it on
the three sample tables (flight, person, reservation) i only get an error
on the StrutsReservationDelegate because of the composite key. Have you
tried this? Just to check if it's related to your setup or the tables
you're using.
Post by Andreas Kemkes
I've looked a bit deeper and it seems that velocity's #parse directive
appears ineffective. This is supposed to work, isn't it. I'm using a
velocity 1.4 jar file. Any ideas what could be the cause?
It is supposed to work, but I haven't had time to test it through very
well yet. Not sure what could cause your problem. Let me know if you
figure out anything or do any more development on this, I'd be happy to
update the cvs. The goal is to get a first version of this up and running
asap, seems to be something people might be finding useful.
Cheers
.eivind
Post by Andreas Kemkes
Thanks,
Andreas
Post by Eivind Waaler
Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.
Regards
.eivind
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Eivind Waaler
2004-03-02 18:47:04 UTC
Permalink
Thanks for the feedback. Logging issues in jira is pretty straightforward,
just create a user and use the 'create new issue' menu option. Our project
is called middlegen3 (should be chosen default if you access it through
the direct link to the project page -
http://jira.codehaus.org/secure/BrowseProject.jspa?id=10110).

So far I've only made minimal changes to the code originally contributed
by Dylan Etkin
(http://jira.codehaus.org/secure/ViewIssue.jspa?key=MIDDLEGEN-11).

I'm not quite familiar enough with Hibernate to know the best way to look
up the Factory. So far I've assumed it's deployed as an MBean available
with JNDI, which I have tested and found to work on JBoss (having deployed
Hibernate as a SAR file).

I guess the best way to solve this is to have different schemes to look up
the factory, we should probably generate some kind of lookup util that can
have a number of different implementations depending on the way hibernate
is to be deployed.

.eivind
Post by Andreas Kemkes
I haven't gotton around to analyze it in detail, but the generated code
looks much better, i.e. the #parse issue is gone. In fact the only thing
I noticed was the following dependency on the airline example in the
net.sf.hibernate.SessionFactory factory =
(net.sf.hibernate.SessionFactory)ctx.lookup("AirlineHibernateFactory");
I know it's work in progress, but I thought you may want to know.
#set( $useVO = $plugin.voPrefix && $plugin.voSuffix )
Wouldn't it be sufficient to use || instead of && and relax the
requirement to specify both voPrefix and voSuffix to either of them.
I'm not familiar with JIRA yet. I'll try to look into it and will
report further comments there.
Thanks for getting me on the right track.
Regards,
Andreas
Post by Eivind Waaler
Ah, I think I know what it is. The adapter plugin also needs some changes
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MIDDLEGEN-11
If you build middlegen with all plugins from cvs it should work, as you
suggested :-)
If you find problems or have suggestions/changes I would appreciate if you
http://jira.codehaus.org/secure/BrowseProject.jspa?id=10110
.eivind
Post by Andreas Kemkes
It'll definitely be useful :-). Thanks for the work In the meantime a
quick test with the airline example didn't show any different results,
still the #parse substitution issue.
Maybe I need to start over with the full cvs version. I only compiled
the adapter and struts plugin from cvs and replaced the libraries in the
last distribution. Maybe that's what causes the problem, even though it
doesn't make sense to me.
Also, I made a separate test with velocity and the #parse substitution
appears to work.
Looks like a rather trivial problem, once it's tracked down ;-).
Andreas
Post by Eivind Waaler
Post by Andreas Kemkes
Post by Eivind Waaler
Hi Andreas,
The adapter plugin for hibernate is still under development and not quite
ready for use unfortunately. Classes with composite keys and other basic
stuff is not yet in place.
I do understand that it is work in progress. It was just too tempting
to see that something is in progress to decouple struts and cmp20. And
there aren't any composite keys in my model right now.
It's nice to see that there's interest in this work :-) When running it on
the three sample tables (flight, person, reservation) i only get an error
on the StrutsReservationDelegate because of the composite key. Have you
tried this? Just to check if it's related to your setup or the tables
you're using.
Post by Andreas Kemkes
I've looked a bit deeper and it seems that velocity's #parse directive
appears ineffective. This is supposed to work, isn't it. I'm using a
velocity 1.4 jar file. Any ideas what could be the cause?
It is supposed to work, but I haven't had time to test it through very
well yet. Not sure what could cause your problem. Let me know if you
figure out anything or do any more development on this, I'd be happy to
update the cvs. The goal is to get a first version of this up and running
asap, seems to be something people might be finding useful.
Cheers
.eivind
Post by Andreas Kemkes
Thanks,
Andreas
Post by Eivind Waaler
Not sure about your xdoclet error. Try searching the xdoclet
lists/documentation for similar errors.
Regards
.eivind
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Andreas Kemkes
2004-03-04 19:30:08 UTC
Permalink
Post by Eivind Waaler
I'm not quite familiar enough with Hibernate to know the best way to look
up the Factory. So far I've assumed it's deployed as an MBean available
with JNDI, which I have tested and found to work on JBoss (having deployed
Hibernate as a SAR file).
I wasn't as much trying to question the scheme that was used as the fact
that the name AirlineHibernateFactory is hard-coded in
hibernate-getSession.vm. The name should be variable.

Also, I've been making a few adjustments due to compiling issues with
the Date data types (I saw the notes in todo.txt), but I'm pretty unsure
whether this is the way to do it.

In hibernate-copyTo.vm:

#if (${column.SqlType} == 91 || ${column.SqlType} == 92) ## 91:
"date" 92: "time"

${persistenceObjectName}.${column.setterName}((java.util.Date)${vo}.${column.getterName}());
#else

${persistenceObjectName}.${column.setterName}(${vo}.${column.getterName}());
#end

and in hibernate-copyFrom.vm:

#if (${column.SqlType} == 91) ## ${column.SqlTypeName} == "date"
${vo}.${column.setterName}(new
java.sql.Date(${persistenceObjectName}.${column.getterName}().getTime()));
#else
#if (${column.SqlType} == 92) ## ${column.SqlTypeName} == "time"
// ${column.SqlTypeName}
${vo}.${column.setterName}(new
java.sql.Time(${persistenceObjectName}.${column.getterName}().getTime()));
#else

${vo}.${column.setterName}(${persistenceObjectName}.${column.getterName}());
#end
#end

This may all be too dependent on the particular SQL database that I'm using.

I've also had issues with foreign keys. Can you please shed some light
on the following comment in delegate.vm:
## IMPLEMENTOR MUST SET THE VARIABLE retPersistenceClass IN THEIR IMPL

Andreas
Eivind Waaler
2004-03-05 07:06:01 UTC
Permalink
Thanks for the feedback.

I'm aware of the date problem. I'll just put your fix in there for now,
then we'll just change it later.

The $retPersistenceClass variable will always be the hibernate java object
I think. The reason for the comment was the adapter for the cmp20 plugin
which can use both remote facade or local cmp reference..

Cheers
.eivind
Post by Andreas Kemkes
Post by Eivind Waaler
I'm not quite familiar enough with Hibernate to know the best way to look
up the Factory. So far I've assumed it's deployed as an MBean available
with JNDI, which I have tested and found to work on JBoss (having deployed
Hibernate as a SAR file).
I wasn't as much trying to question the scheme that was used as the fact
that the name AirlineHibernateFactory is hard-coded in
hibernate-getSession.vm. The name should be variable.
Also, I've been making a few adjustments due to compiling issues with
the Date data types (I saw the notes in todo.txt), but I'm pretty unsure
whether this is the way to do it.
"date" 92: "time"
${persistenceObjectName}.${column.setterName}((java.util.Date)${vo}.${column.getterName}());
#else
${persistenceObjectName}.${column.setterName}(${vo}.${column.getterName}());
#end
#if (${column.SqlType} == 91) ## ${column.SqlTypeName} == "date"
${vo}.${column.setterName}(new
java.sql.Date(${persistenceObjectName}.${column.getterName}().getTime()));
#else
#if (${column.SqlType} == 92) ## ${column.SqlTypeName} == "time"
// ${column.SqlTypeName}
${vo}.${column.setterName}(new
java.sql.Time(${persistenceObjectName}.${column.getterName}().getTime()));
#else
${vo}.${column.setterName}(${persistenceObjectName}.${column.getterName}());
#end
#end
This may all be too dependent on the particular SQL database that I'm using.
I've also had issues with foreign keys. Can you please shed some light
## IMPLEMENTOR MUST SET THE VARIABLE retPersistenceClass IN THEIR IMPL
Andreas
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Russell Simpkins
2004-03-02 10:42:05 UTC
Permalink
If you dl'd the latest middlegen, then there is a samples directory that
has a build.xml which will gen struts, hibernate and ejb. The struts
framework gen relies on EJB, so don't drop the ejb part.

-----Original Message-----
From: middlegen-user-***@lists.sourceforge.net
[mailto:middlegen-user-***@lists.sourceforge.net] On Behalf Of James
Neville
Sent: Tuesday, March 02, 2004 6:26 AM
To: middlegen-***@lists.sourceforge.net
Subject: [Middlegen-user] Struts Action/ActionForm generation &
Hibernate

All,

I'm new to the list; been having a browse on the SF archive, trying to
get a better handle on where this project is going..

We've just been trying out Middlegen for Hibernate mapping generation
---> VO generation.
Its working great, and its temping me to ditch a proprietary persistence
architecture and replace it with Hibernate (this project is also doing v
well-IMHO)!

Now i'm hearing some noises about Struts framework generation via
Middlegen (ie this msg); I can only seem to gen EJB's from it, and the
documentation is falling rather short.... this is about all I know how
to do in an ant task:-

<target
name="middlegen-struts"
description="Run Middlegen Struts Generator"
unless="middlegen.skip"
depends="prepare">

<taskdef name="middlegen" classname="middlegen.MiddlegenTask"
classpathref="project.class.path"/>

<middlegen
appname="${app.name}"
prefsdir="${rsrc.dir}"
gui="true"
databaseurl="${database.url}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}">
<struts
destination="${build.dir}"
package="com.bb.struts"
<jsp destination="${build.dir}/jsp" />
</struts>
</middlegen>
</target>

Is this the current state of development in CVS, or is there more we can
test out? Anyone have any doco?:)
If not, does anyone have any suggestions for automating generation of a
Struts application framework?

Thanks for any thoughts, and apologies for all the questions ;)

James.







-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
Eivind Waaler
2004-03-02 11:53:20 UTC
Permalink
Current CVS version uses the new adapter plugin. This currently only works
for ejb, but a hibernate version is under development. There has been some
questions about this, we'll try to get it done soon together with some
updated documentation. The whole struts plugin will also be reviewed.

Regards
.eivindw.
Post by Russell Simpkins
If you dl'd the latest middlegen, then there is a samples directory that
has a build.xml which will gen struts, hibernate and ejb. The struts
framework gen relies on EJB, so don't drop the ejb part.
-----Original Message-----
Neville
Sent: Tuesday, March 02, 2004 6:26 AM
Subject: [Middlegen-user] Struts Action/ActionForm generation &
Hibernate
All,
I'm new to the list; been having a browse on the SF archive, trying to
get a better handle on where this project is going..
We've just been trying out Middlegen for Hibernate mapping generation
---> VO generation.
Its working great, and its temping me to ditch a proprietary persistence
architecture and replace it with Hibernate (this project is also doing v
well-IMHO)!
Now i'm hearing some noises about Struts framework generation via
Middlegen (ie this msg); I can only seem to gen EJB's from it, and the
documentation is falling rather short.... this is about all I know how
to do in an ant task:-
<target
name="middlegen-struts"
description="Run Middlegen Struts Generator"
unless="middlegen.skip"
depends="prepare">
<taskdef name="middlegen" classname="middlegen.MiddlegenTask"
classpathref="project.class.path"/>
<middlegen
appname="${app.name}"
prefsdir="${rsrc.dir}"
gui="true"
databaseurl="${database.url}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}">
<struts
destination="${build.dir}"
package="com.bb.struts"
<jsp destination="${build.dir}/jsp" />
</struts>
</middlegen>
</target>
Is this the current state of development in CVS, or is there more we can
test out? Anyone have any doco?:)
If not, does anyone have any suggestions for automating generation of a
Struts application framework?
Thanks for any thoughts, and apologies for all the questions ;)
James.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...