Re: Java Plugin / JavaClass.vm
Eivind Waaler <[email protected]>
| Newsgroups | gmane.comp.java.ejb.middlegen.user |
|---|---|
| Message-ID | <[email protected]> |
Use the hbm2java tool from Hibernate. You need hibernate-tools.jar +
dependencies. In the Middlegen sample we use this task:
<target name="hbm2java" depends="middlegen" description="...">
<taskdef
name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="lib.class.path"
/>
<hbm2java output="${build.gen-src.dir}">
<fileset dir="${build.gen-src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
Cheers
.eivind
On Mon, 30 Aug 2004, M.-Leander Reimer wrote:
> Hi Mario,
>
> I think with the Java plugin you can use something like
> ${column.javaType} to get the preferred Java type for the current DB
> column. Have a look at the source of middlegen/javax/JavaColumn.java and
> all its getter methods.
>
> Leander
>
>
> Mario Laureti schrieb:
>
> > Hello,
> >
> > I use Middlegen to generate xml file for hibernate out of a database schema.
> > I would also like to generate Java source class with setters and getters for every database table from the database schema.
> >
> > The following is how I am doing this:
> >
> > I am using a java plug in.
> > I wrote a small template.
> >
> > Is this the right way to do this?
> >
> > If yes, here is my problem:
> >
> > Only the context objects $table and $tables are available. It would be nice to have
> > a $javaTable in the context to know which Java types to use to generate the Java class.
> >
> > For now I am hard coding this information in the template and I do not feel that it is the right thing to do...
> >
> > Can any one guide me in the right direction? I have attached the template I started.
> >
> > Thanks
> >
> > Mario Laureti
> >
> >
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> _______________________________________________
> middlegen-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/middlegen-user
>
>
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click