-->
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.  [ 6 posts ] 
Author Message
 Post subject: How to call custom java class in *.hbm.ftl files ?
PostPosted: Wed Feb 07, 2007 10:01 am 
Beginner
Beginner

Joined: Tue Jan 30, 2007 1:35 pm
Posts: 27
Hi All,

I'm new in hibernate. I need to modify hibernate-mapping.hbm.ftl, to return a value :
for example in hibernate-mapping.hbm.ftl I add another function, to return a specify string:

<# hmgs.getStudentName()>

How can I do that ? Please give me some hints..how to do that. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 5:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i do not understand your question.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 6:20 am 
Beginner
Beginner

Joined: Tue Jan 30, 2007 1:35 pm
Posts: 27
Thanks for ur response. Actually I want to pass values to a custom property of hibernate-mapping.hbm.ftl templates.

for e.g :
-------------------------------------------------------------------------------------
<#if clazz.table.comment?exists>
<comment>${column.quotedName} comment>
</#if>

${API_name}
------------------------------------------------------------------------------------

I have already code my custom exporter to extend HibernateMappingExporter. In my custom exporter, I delcare the variable in setupContext().

String strTableName = "";

protected void setupContext() {

getProperties().put("API_name", "API_PK_"+strTableName);

}

But how can I pass in the tablename in my custom exporter ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 7:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i'm still not sure what you actually want, but take a look at the docs:

http://www.hibernate.org/hib_docs/tools ... e/#d0e1336

it explains how to set properties etc.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 11:43 am 
Beginner
Beginner

Joined: Tue Jan 30, 2007 1:35 pm
Posts: 27
haha...make it short "how can I get the table name from HibernateMappingExporter ? "

Which API I can call ? Thanks in advance max.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 09, 2007 8:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
eh...i'll suggest you look in HibernateMappingExporter and the related templates how it access the Configuration API ;)

_________________
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.  [ 6 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.