-->
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: accessing "catalog" attribute of hbm.xml from temp
PostPosted: Fri Sep 15, 2006 3:21 pm 
Newbie

Joined: Fri Sep 15, 2006 2:59 pm
Posts: 1
These may be explained somewhere in the docs, if these are, please point me to the proper place in the docs.

I want to add a custom property (member variable) in the generated xxHome (DAO) calsses which I want set to same value as the "catalog" attribute in the hbm.xml's "class" element. Is there a way to access the value of "catalog" property from the template (.ftl) file ? I know how to make the template generate the custom code I want, I just want to get some pointers on how to access "catalog" property.

2nd question is, is there a property or attribute I can set in the hbm files to tell the code generator NOT to generate "Home" (DAO) class for that table ?

Thanks in advance for any help or pointers you can provide ?

--sm


Top
 Profile  
 
 Post subject: Re: accessing "catalog" attribute of hbm.xml from
PostPosted: Fri Sep 15, 2006 5:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sm94066 wrote:
These may be explained somewhere in the docs, if these are, please point me to the proper place in the docs.


javadoc api for the org.hibernate.mapping package ;)

Quote:
I want to add a custom property (member variable) in the generated xxHome (DAO) calsses which I want set to same value as the "catalog" attribute in the hbm.xml's "class" element.


sounds leaky..

Quote:
Is there a way to access the value of "catalog" property from the template (.ftl) file ? I know how to make the template generate the custom code I want, I just want to get some pointers on how to access "catalog" property.


clazz.getTable().getCatalog() should give it to you (unless the catalog is the default and then it will be null)

Quote:
2nd question is, is there a property or attribute I can set in the hbm files to tell the code generator NOT to generate "Home" (DAO) class for that table ?


no, but if the result of the template is an empty string when trimmed then no file should be generated. you can use that trick to have an if statement in the beginnig to just skip everything if a certain criteria is met.

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