Discussion:
[Middlegen-user] MiddleGen opening non-zip files in CLASSPATH
Jonathan Scott
2004-08-08 23:50:05 UTC
Permalink
Hello,

I am curious if anyone else has noticed that MiddleGen tries open all files in my CLASSPATH as if they were a .zip file. For instance it is trying to open jmf.properties as if it were a jar/zip file to be loaded and throws the exception below. Any help would be greatly appreciated.

java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:112)
at java.util.zip.ZipFile.<init>(ZipFile.java:128)
at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:902)
at org.apache.tools.ant.AntClassLoader.getResource(AntClassLoader.java:831)
at java.lang.Class.getResource(Class.java:1352)
at middlegen.plugins.hibernate.HibernatePlugin.registerFileProducers(Unknown Source)
at middlegen.Plugin.generate(Plugin.java:509)
at middlegen.Middlegen.writeSource(Middlegen.java:415)
at middlegen.MiddlegenTask.execute(MiddlegenTask.java:430)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.Main.start(Main.java:151)
at org.apache.tools.ant.Main.main(Main.java:241)

Jonathan Scott
--
Jonathan Scott, Programmer, Vanten K.K.
***@vanten.com Tel: 03-5919-0266
http://www.vanten.com Fax: 03-5919-0267
Jonathan Scott
2004-08-10 03:37:04 UTC
Permalink
Hi All,

I am wondering if it is at all possible to read tables from a SQL file instead of from the DB itself. The point being that the SQL files will tell us the current structure of the DB better than a possibly out of date schema, built only who knows when.

If there is such a way to get the schema from files instead of the DB, please advise on how to do it, or where to look on how to do it.

Much appreciated,
Jonathan Scott
--
Jonathan Scott, Programmer, Vanten K.K.
***@vanten.com Tel: 03-5919-0266
http://www.vanten.com Fax: 03-5919-0267
Erik Wright
2004-08-10 11:32:04 UTC
Permalink
You could always load the SQL into a temporary schema/database, or a
Cloudscape/HSQLDB in-memory DB or something, and then point Middlegen at
that.

Our build process connects to Oracle, creates a user for the developer
performing the build (suffixes the user name with '_${env.USER}'), which
automatically creates a schema for them, then connects as that user and
inserts our schema via a SQL script. All that's left at that point is to
run Middlegen.

But if you don't have that kind of flexibility with your actual DB
platform, I suppose you could run a DB locally, either a Java one (which
might be easier to configure as part of an integrated build) or MySQL,
PostgreSQL, etc.

-Erik
Post by Jonathan Scott
Hi All,
I am wondering if it is at all possible to read tables from a SQL file instead of from the DB itself. The point being that the SQL files will tell us the current structure of the DB better than a possibly out of date schema, built only who knows when.
If there is such a way to get the schema from files instead of the DB, please advise on how to do it, or where to look on how to do it.
Much appreciated,
Jonathan Scott
Wouter Boers
2004-08-13 06:01:07 UTC
Permalink
You can specify the tables to use with the <table/> tag. Just look at the
documentation.

Regards, Wouter
Post by Jonathan Scott
Hi All,
I am wondering if it is at all possible to read tables from a SQL file
instead of from the DB itself. The point being that the SQL files will
tell us the current structure of the DB better than a possibly out of date
schema, built only who knows when.
If there is such a way to get the schema from files instead of the DB,
please advise on how to do it, or where to look on how to do it.
Much appreciated,
Jonathan Scott
--
Jonathan Scott, Programmer, Vanten K.K.
http://www.vanten.com Fax: 03-5919-0267
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Met vriendelijk groet, Wouter Boers

Darren Hartford
2004-08-10 11:50:09 UTC
Permalink
Yup, running a DB in standalone/embed mode would work well, and I am doing so in production (my choice is McKoi, waiting for Cloudscape to be accepted/mature in open-source world outside of IBM). Hsql, McKoi, and Cloudscape for java-compatible. Would recommend McKoi or Cloudscape, issues with HSQL related to compound primary keys (more HSQL than Middlegen). If you want a little extra omph, also look at http://mogwai.sourceforge.net/ ERDesigner for modelling the standalone/embed java database file that you can keep with your project and from the modelling tool generate the DDL's for other database types (or commercial equiv DB modelling tool).

-D
-----Original Message-----
Sent: Tuesday, August 10, 2004 9:29 AM
Subject: Re: [Middlegen-user] Using sql files instead of the DB itself
You could always load the SQL into a temporary schema/database, or a
Cloudscape/HSQLDB in-memory DB or something, and then point
Middlegen at
that.
Our build process connects to Oracle, creates a user for the developer
performing the build (suffixes the user name with
'_${env.USER}'), which
automatically creates a schema for them, then connects as
that user and
inserts our schema via a SQL script. All that's left at that
point is to
run Middlegen.
But if you don't have that kind of flexibility with your actual DB
platform, I suppose you could run a DB locally, either a Java
one (which
might be easier to configure as part of an integrated build) or MySQL,
PostgreSQL, etc.
-Erik
Post by Jonathan Scott
Hi All,
I am wondering if it is at all possible to read tables from
a SQL file instead of from the DB itself. The point being
that the SQL files will tell us the current structure of the
DB better than a possibly out of date schema, built only who
knows when.
Post by Jonathan Scott
If there is such a way to get the schema from files instead
of the DB, please advise on how to do it, or where to look on
how to do it.
Post by Jonathan Scott
Much appreciated,
Jonathan Scott
d***@lexmark.com
2004-08-10 15:24:00 UTC
Permalink
Hi Erik,

Do you do anything in your build process to set up the equals() method, or
sequence names? Am having difficulty automating this...

cheers,

David



|---------+------------------------------------------>
| | Erik Wright |
| | <***@zeroknowledge.com> |
| | Sent by: |
| | middlegen-user-***@lists.sour|
| | ceforge.net |
| | |
| | |
| | 08/10/2004 09:28 AM |
| | Please respond to |
| | middlegen-user |
| | |
|---------+------------------------------------------>
------------------------------------------------------------------------------------------------------------------------|
| |
| To: middlegen-***@lists.sourceforge.net |
| cc: |
| Subject: Re: [Middlegen-user] Using sql files instead of the DB itself |
------------------------------------------------------------------------------------------------------------------------|
You could always load the SQL into a temporary schema/database, or a
Cloudscape/HSQLDB in-memory DB or something, and then point Middlegen at
that.

Our build process connects to Oracle, creates a user for the developer
performing the build (suffixes the user name with '_${env.USER}'), which
automatically creates a schema for them, then connects as that user and
inserts our schema via a SQL script. All that's left at that point is to
run Middlegen.

But if you don't have that kind of flexibility with your actual DB
platform, I suppose you could run a DB locally, either a Java one (which
might be easier to configure as part of an integrated build) or MySQL,
PostgreSQL, etc.

-Erik
Hi All,
I am wondering if it is at all possible to read tables from a SQL file
instead of from the DB itself. The point being that the SQL files will tell
us the current structure of the DB better than a possibly out of date
schema, built only who knows when.
If there is such a way to get the schema from files instead of the DB,
please advise on how to do it, or where to look on how to do it.
Much appreciated,
Jonathan Scott
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
Erik Wright
2004-08-10 15:50:07 UTC
Permalink
Assuming you're using EJBs, as we are, you don't want to use equals() -
use isIdenticalTo() instead. If you want custom comparison behaviour you
will need to implement some sort of business method yourself by writing
a merge file.

For sequences, we did experiment with the built-in sequence behaviour,
but to the best of my recollection all that was possible was to specify
one sequence that would be shared amongst all tables.

In the end, we modified Middlegen to have some very specific behaviour
with regards to sequences and pk generation. If you want to customize
the behaviour, you'll want to look at the entity bean template which is
in the Middlegen source tree at:

plugins/entitybean/src/middlegen/plugins/entitybean/entity-cmp-20.vm

Ours looks up a Stateless Session Bean, passes the name of the table,
and receives back a PK. The implementation of the bean is specific to
our project.

-Erik
Post by d***@lexmark.com
Hi Erik,
Do you do anything in your build process to set up the equals() method, or
sequence names? Am having difficulty automating this...
cheers,
David
|---------+------------------------------------------>
| | Erik Wright |
| | Sent by: |
| | ceforge.net |
| | |
| | |
| | 08/10/2004 09:28 AM |
| | Please respond to |
| | middlegen-user |
| | |
|---------+------------------------------------------>
------------------------------------------------------------------------------------------------------------------------|
| |
| cc: |
| Subject: Re: [Middlegen-user] Using sql files instead of the DB itself |
------------------------------------------------------------------------------------------------------------------------|
You could always load the SQL into a temporary schema/database, or a
Cloudscape/HSQLDB in-memory DB or something, and then point Middlegen at
that.
Our build process connects to Oracle, creates a user for the developer
performing the build (suffixes the user name with '_${env.USER}'), which
automatically creates a schema for them, then connects as that user and
inserts our schema via a SQL script. All that's left at that point is to
run Middlegen.
But if you don't have that kind of flexibility with your actual DB
platform, I suppose you could run a DB locally, either a Java one (which
might be easier to configure as part of an integrated build) or MySQL,
PostgreSQL, etc.
-Erik
Hi All,
I am wondering if it is at all possible to read tables from a SQL file
instead of from the DB itself. The point being that the SQL files will tell
us the current structure of the DB better than a possibly out of date
schema, built only who knows when.
If there is such a way to get the schema from files instead of the DB,
please advise on how to do it, or where to look on how to do it.
Much appreciated,
Jonathan Scott
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
d***@lexmark.com
2004-08-10 17:51:11 UTC
Permalink
Hi Erik,

We're not using EJBs, just a web app accessing our business logic. Do you
know if equals() needs to be defined in this case?

I believe now that you can specify in each .hbm.xml the sequence name for
each table, just trying to figure it out how to set it via Ant! I guess I
could modify Middlegen too, but then it would be db specific.

cheers,

David



|---------+------------------------------------------>
| | Erik Wright |
| | <***@zeroknowledge.com> |
| | Sent by: |
| | middlegen-user-***@lists.sour|
| | ceforge.net |
| | |
| | |
| | 08/10/2004 01:46 PM |
| | Please respond to |
| | middlegen-user |
| | |
|---------+------------------------------------------>
------------------------------------------------------------------------------------------------------------------------|
| |
| To: middlegen-***@lists.sourceforge.net |
| cc: |
| Subject: Re: [Middlegen-user] Using sql files instead of the DB itself |
------------------------------------------------------------------------------------------------------------------------|
Assuming you're using EJBs, as we are, you don't want to use equals() -
use isIdenticalTo() instead. If you want custom comparison behaviour you
will need to implement some sort of business method yourself by writing
a merge file.

For sequences, we did experiment with the built-in sequence behaviour,
but to the best of my recollection all that was possible was to specify
one sequence that would be shared amongst all tables.

In the end, we modified Middlegen to have some very specific behaviour
with regards to sequences and pk generation. If you want to customize
the behaviour, you'll want to look at the entity bean template which is
in the Middlegen source tree at:

plugins/entitybean/src/middlegen/plugins/entitybean/entity-cmp-20.vm

Ours looks up a Stateless Session Bean, passes the name of the table,
and receives back a PK. The implementation of the bean is specific to
our project.

-Erik
Hi Erik,
Do you do anything in your build process to set up the equals() method,
or
sequence names? Am having difficulty automating this...
cheers,
David
|---------+------------------------------------------>
| | Erik Wright |
| | Sent by: |
| | ceforge.net |
| | |
| | |
| | 08/10/2004 09:28 AM |
| | Please respond to |
| | middlegen-user |
| | |
|---------+------------------------------------------>
------------------------------------------------------------------------------------------------------------------------|
|
|
|
|
| Subject: Re: [Middlegen-user] Using sql files instead of the
DB itself |
------------------------------------------------------------------------------------------------------------------------|
You could always load the SQL into a temporary schema/database, or a
Cloudscape/HSQLDB in-memory DB or something, and then point Middlegen at
that.
Our build process connects to Oracle, creates a user for the developer
performing the build (suffixes the user name with '_${env.USER}'), which
automatically creates a schema for them, then connects as that user and
inserts our schema via a SQL script. All that's left at that point is to
run Middlegen.
But if you don't have that kind of flexibility with your actual DB
platform, I suppose you could run a DB locally, either a Java one (which
might be easier to configure as part of an integrated build) or MySQL,
PostgreSQL, etc.
-Erik
Post by Jonathan Scott
Hi All,
I am wondering if it is at all possible to read tables from a SQL file
instead of from the DB itself. The point being that the SQL files will
tell
us the current structure of the DB better than a possibly out of date
schema, built only who knows when.
Post by Jonathan Scott
If there is such a way to get the schema from files instead of the DB,
please advise on how to do it, or where to look on how to do it.
Post by Jonathan Scott
Much appreciated,
Jonathan Scott
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
Erik Wright
2004-08-10 18:15:00 UTC
Permalink
Sorry David. Perhaps a Hibernate expert will have some answers for you
but I'm not familiar with the tool.

-Erik
Post by d***@lexmark.com
Hi Erik,
We're not using EJBs, just a web app accessing our business logic. Do you
know if equals() needs to be defined in this case?
I believe now that you can specify in each .hbm.xml the sequence name for
each table, just trying to figure it out how to set it via Ant! I guess I
could modify Middlegen too, but then it would be db specific.
cheers,
David
|---------+------------------------------------------>
| | Erik Wright |
| | Sent by: |
| | ceforge.net |
| | |
| | |
| | 08/10/2004 01:46 PM |
| | Please respond to |
| | middlegen-user |
| | |
|---------+------------------------------------------>
------------------------------------------------------------------------------------------------------------------------|
| |
| cc: |
| Subject: Re: [Middlegen-user] Using sql files instead of the DB itself |
------------------------------------------------------------------------------------------------------------------------|
Assuming you're using EJBs, as we are, you don't want to use equals() -
use isIdenticalTo() instead. If you want custom comparison behaviour you
will need to implement some sort of business method yourself by writing
a merge file.
For sequences, we did experiment with the built-in sequence behaviour,
but to the best of my recollection all that was possible was to specify
one sequence that would be shared amongst all tables.
In the end, we modified Middlegen to have some very specific behaviour
with regards to sequences and pk generation. If you want to customize
the behaviour, you'll want to look at the entity bean template which is
plugins/entitybean/src/middlegen/plugins/entitybean/entity-cmp-20.vm
Ours looks up a Stateless Session Bean, passes the name of the table,
and receives back a PK. The implementation of the bean is specific to
our project.
-Erik
Hi Erik,
Do you do anything in your build process to set up the equals() method,
or
sequence names? Am having difficulty automating this...
cheers,
David
|---------+------------------------------------------>
| | Erik Wright |
| | Sent by: |
| | ceforge.net |
| | |
| | |
| | 08/10/2004 09:28 AM |
| | Please respond to |
| | middlegen-user |
| | |
|---------+------------------------------------------>
------------------------------------------------------------------------------------------------------------------------|
|
|
|
|
| Subject: Re: [Middlegen-user] Using sql files instead of the
DB itself |
------------------------------------------------------------------------------------------------------------------------|
You could always load the SQL into a temporary schema/database, or a
Cloudscape/HSQLDB in-memory DB or something, and then point Middlegen at
that.
Our build process connects to Oracle, creates a user for the developer
performing the build (suffixes the user name with '_${env.USER}'), which
automatically creates a schema for them, then connects as that user and
inserts our schema via a SQL script. All that's left at that point is to
run Middlegen.
But if you don't have that kind of flexibility with your actual DB
platform, I suppose you could run a DB locally, either a Java one (which
might be easier to configure as part of an integrated build) or MySQL,
PostgreSQL, etc.
-Erik
Post by Jonathan Scott
Hi All,
I am wondering if it is at all possible to read tables from a SQL file
instead of from the DB itself. The point being that the SQL files will
tell
us the current structure of the DB better than a possibly out of date
schema, built only who knows when.
Post by Jonathan Scott
If there is such a way to get the schema from files instead of the DB,
please advise on how to do it, or where to look on how to do it.
Post by Jonathan Scott
Much appreciated,
Jonathan Scott
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...