facebook

Velocity not allowing inline macros

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #325652 Reply

    Phoenix_133
    Member

    Hello all,

    after unsuccessfully searching through forum posts, reading webistes, etc.
    I am back to my unsolved problem:

    I am trying to use velocity templates to generate custom DAOs and POJOs.
    On using the velocity templates, I added my own macro into a file named Common.vm
    I then wanted to include this Common.vm within the main Pojo template Pojo.vm using the directive $template.Common. As this file also holds macros, that are used within the DAO processing, I wanted this file Common.vm to be on a common folder level:
    <workspace>/MyProject/src/velocityTemplates/Common.vm instead of /MyProject/src/velocityTemplates/pojo/Common.vm
    Once I start the reverse engineering, I always get the following warning:

    2012-04-30 13:07:11,803 WARN Worker-28 org.hibernate.tool.hbm2x.template - Velocimacro : VM addition rejected : toUnderscore : inline not allowed to replace existing VM

    I found the following 2 posts:
    http://www.mail-archive.com/user@velocity.apache.org/msg00036.html
    https://forum.hibernate.org/viewtopic.php?f=6&t=955557&view=next

    One of them suggests, that you will need to change the velocity.properties file.
    The other one says, that hibernate encapsulated this file, so that users should not tamper it directly. Where can I tell velocity within myEclipse, that I want to use my own macros?

    I looked at your tutorial on http://www.myeclipseide.com/documentation/quickstarts/hibernate/#5-5. But sadly, this whole subchapter named “5.5 Using templates to fine tune generated code’ seems to be a bit short on that respect. I could not find any more information on this topic. Only the apache velocity webiste might help in that respect.
    Any more detailed update on this chapter would be great.
    I found out, that this would normally require a file named velocity.properties to be edited. I did not find any such file, so I guess, this has to be created. Does myEclipse look for such a file, so I can use inline macros? Is my approach for putting in my own macros correct? Does the GUI currently provide means to customize such velocity-relevant settings?

    Maybe have a small example within this chapter, explaining on how to setup your toolchain, so it allows for changing properties.

    As a suggestion: I was missing some flash player on firefox in order to view your training vidoes embedded within the text. After opening it in Opera, I saw those. Mabe it would be a good idear, to show an image with some helpful information in case someone is missing this specific plugin? Before using opera, I just had huge blank spaces, where the video should be.

    #325702 Reply

    support-swapna
    Moderator

    Phoenix_133,

    Sorry that you are seeing this issue. I could replicate the issue at my end.

    You can directly include the macro in one of the existing vm files and call it instead of using the #template.

    I am afraid there is no way to customize the velocity.properties file and I suggest you use the workaround instead.

    Hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Velocity not allowing inline macros

You must be logged in to post in the forum log in