I am generating POJO using the following code
My aim is to access the fields length , precision,null /not null , Is primary key check in the ftl file.
I have access to the pojo .Now how do i get to the above properties?
Note : Iam able to do the following
pojo.getAllPropertiesIterator()
<#foreach field in pojo.getAllPropertiesIterator()>
field.getColumnIterator()
<#foreach columnMeta in field.getColumnIterator()>
columnMeta.getLength()
But this breaks
columnMeta.getPrecision() .
Can you please explain this .Thanks
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2x.TemplateProducer;
import org.hibernate.tool.hbm2x.pojo.POJOClass;
Public class HibernateAllCodeExporter extends
HibernateCodeExporter
{ private File outputDirLoc;
public HibernateAllCodeExporter()
{
super();
}
public HibernateAllCodeExporter(
Configuration cfg_,
File outputdir_)
{
super(cfg_, outputdir_);
}
@Override
protected void exportPOJO(
Map additionalContext_,
POJOClass element_) {
TemplateProducer producer = new TemplateProducer(getTemplateHelper(), getArtifactCollector());
additionalContext_.put("pojo", element_);
additionalContext_.put("clazz", element_.getDecoratedObject());
additionalContext_.put("fieldNaming", fieldNaming);
extraSettings.setExtraPropertiesPath(getExtraPropertiesPath());
additionalContext_.put("extraSettings", extraSettings);
additionalContext_.put("md5sum", md5sum);[/b]