-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Checking a primitive in velocity templates
PostPosted: Tue Feb 21, 2006 2:34 pm 
Newbie

Joined: Tue Feb 21, 2006 2:16 pm
Posts: 1
Hi,
I`m using the Hibernate Tools Version 3.1 beta4 and I`m trying to create my own custom template to insert an "I" for all non-primitive and non-collection types in the mutators of my pojo. So I need to check if a property in the velocity template is a primitive or a collection are the methods available to do this????

I can`t find a Java Doc for any of the classes used in the templates after searching the Tools docs and the website.

Thanks

Darran

Example of what I`m trying to do :-

Code:
    // Property accessors
#foreach($property in $pojo.getAllPropertiesIterator())
#if($pojo.getMetaAttribAsBool($property, "gen-property", true))
#if($pojo.hasFieldJavaDoc($property))
    /**       
     * $pojo.getFieldJavaDoc($property, 4)
     */
#end

#if($property.<[b]isPrimary????[/b]>)

$templates.Ejb3PropertyGetAnnotation
    $pojo.getPropertyGetModifiers($property) $pojo.getJavaTypeName($property, $jdk5) $pojo.getGetterSignature($property)() {
        return this.$property.name;
    }
   
 
    $pojo.getPropertySetModifiers($property) void set$pojo.getPropertyName($property)($pojo.getJavaTypeName($property, $jdk5) $property.Name) {
        this.$property.Name = $property.Name;
    }

#else
$templates.Ejb3PropertyGetAnnotation
    $pojo.getPropertyGetModifiers($property) I$pojo.getJavaTypeName($property, $jdk5) $pojo.getGetterSignature($property)() {
        return this.$property.name;
    }
   
 
    $pojo.getPropertySetModifiers($property) void set$pojo.getPropertyName($property)(I$pojo.getJavaTypeName($property, $jdk5) $property.Name) {
        this.$property.Name = $property.Name;
    }

#end
#end


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 6:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
look at Cfg2JavaTool and Hbm2JavaTool.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.