This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

What is the use of VM file?  RSS feed

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Members,

I was working on a project where I saw some VM files for generating classes having some code like



However in Java files which are generated from this VM file has almost the same code style. So can any one explain me how VM file works?

I found one document in this support but could not able to understand.

Thanks in advance !



 
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks as if the Apache Velocity templating library is being used to generate Java source code.
 
Fidel Edwards
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:That looks as if the Apache Velocity templating library is being used to generate Java source code.



In fact it is swing based client/server project. I talked with a developer for the same he told me earlier these files being used for developing some mapping between java file and database. Now all the newly developed module is using hibernate for the same.

I tried to create a new getter/setter in the older code. Developer told me just create abstract getter and setter method in abstract class. And then try to generate the Implementation class via rant export command.

I don't know but I see some ruby.... something.. something.. on console. I am totally discombobulated
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HibernateTools may use Velocity templates for codegen (it's either that or FreeMarker, I forget which).

Rant is a Ruby-based makefile system.
 
Sheriff
Posts: 21747
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:That looks as if the Apache Velocity templating library is being used to generate Java source code.


As someone who has worked with Velocity as recently as today I concur - this looks like a Velocity template file.
 
Fidel Edwards
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Prime wrote:

Ulf Dittmer wrote:That looks as if the Apache Velocity templating library is being used to generate Java source code.


As someone who has worked with Velocity as recently as today I concur - this looks like a Velocity template file.



But what I am seeing this project is using these files as generator for java files.
 
Ulf Dittmer
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Fidel Edwards wrote:But what I am seeing this project is using these files as generator for java files.


What do you mean, "but"? Aren't you saying the exact same thing as Rob and I before?
 
Fidel Edwards
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:
What do you mean, "but"? Aren't you saying the exact same thing as Rob and I before?



Sorry for restating the things. If I get any tutorial or example then that will be really helpful.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Fidel Edwards wrote:But what I am seeing this project is using these files as generator for java files.


That's correct--they are.

What, precisely, do you want a tutorial on? Velocity? Check the Velocity website and get the docs for your version. HibernateTools (if that's what's being used)? The Hibernate docs have some information about that and the reveng file.
 
Fidel Edwards
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

David Newton wrote:
Check the Velocity website and get the docs for your version. HibernateTools (if that's what's being used)? The Hibernate docs have some information about that and the reveng file.



Thanks David!
 
Because those who mind don't matter and those who matter don't mind - Seuss. Tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!