-->
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.  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

Using FreeMarker instead of Velocity
Yes, lets get sensible error messages 50%  50%  [ 2 ]
No, I am addicted to spend hours of leading-no-where debugging 25%  25%  [ 1 ]
I don't care 25%  25%  [ 1 ]
I have an alternative suggestion (place a comment) 0%  0%  [ 0 ]
Total votes : 4
Author Message
 Post subject:
PostPosted: Mon Feb 06, 2006 5:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
It's done - head now has freemarker instead of velocity as its template engine.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 6:14 pm 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
<#if pojo.needsToString()> /**
* toString
* @return String
*/
public String toString() {
StringBuffer buffer = new StringBuffer();

buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" [");
<#foreach property in pojo.getToStringPropertiesIterator()>
buffer.append("${property.name}").append("='").append(${pojo.getGetterSignature(property)}()).append("' ");
</#foreach> buffer.append("]");

return buffer.toString();
}
</#if>

here is my toString Template
also working on a fix for the EqualsHashcode Template but not finished yet.

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 1:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what does it fix ? ...and could you put it in jira as a patch ? thank you

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 4:27 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
may be I did something wrong but I checked out the head of the Tools (HibernateExt) and I got a template parsing error on the ToString template same applies to equalsHashcode template.

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 4:31 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
for this reason I didn't post it to jira. but if it's really a bug I'll add it of course also the equalsHashcode template if it has to be fixed. I'm working on a port for our Rendering Tool in Raptor so for that reason I can also make a fix for that if needed.

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 6:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what is the template parsing error ?

in any case, fixes should be submitted as *patches* to jira...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 2:58 pm 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.

BUILD FAILED
C:\Dokumente und Einstellungen\oschmitz\workspace\build.xml:253: org.hibernate.tool.hbm2x.ExporterException: Error while processing template string
That is the only Error message I get when using the sources form cvs.

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 4:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
run it with -debug

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 5:16 pm 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
Loaded from C:\Documents and Settings\Administrator\workspace\XCOM Ticketsystem Server\lib\freemarker.jar freemarker/core/StopException.class
Class freemarker.core.StopException loaded from ant loader (parentFirst)

BUILD FAILED
C:\Documents and Settings\Administrator\workspace\XCOM Ticketsystem Server\build.xml:299: org.hibernate.tool.hbm2x.ExporterException: Error while processing template string
at org.apache.tools.ant.Task.perform(Task.java:373)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: org.hibernate.tool.hbm2x.ExporterException: Error while processing template string
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:249)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:101)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:84)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:69)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:93)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:59)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:160)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
... 9 more
Caused by: freemarker.template.TemplateModelException: Method public boolean org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode() threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(de.xcom.ticketsystem.pojo.Rights)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.isTrue(Expression.java:138)
at freemarker.core.AndExpression.isTrue(AndExpression.java:68)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.visit(Environment.java:233)
at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:231)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:243)
... 22 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:583)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 41 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.mapping.Property.isNaturalIdentifier()Z
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.usePropertyInEquals(BasicPOJOClass.java:224)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(BasicPOJOClass.java:266)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(BasicPOJOClass.java:275)
... 47 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Error while processing template string
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:249)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:101)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:84)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:69)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:93)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:59)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:160)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: freemarker.template.TemplateModelException: Method public boolean org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode() threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(de.xcom.ticketsystem.pojo.Rights)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.isTrue(Expression.java:138)
at freemarker.core.AndExpression.isTrue(AndExpression.java:68)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.visit(Environment.java:233)
at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:231)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:243)
... 22 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:583)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 41 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.mapping.Property.isNaturalIdentifier()Z
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.usePropertyInEquals(BasicPOJOClass.java:224)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(BasicPOJOClass.java:266)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(BasicPOJOClass.java:275)
... 47 more

Total time: 10 seconds
is the trace and the mapping is :

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="de.xcom.ticketsystem.pojo.Rights" table="rights" schema="public">
<cache usage="read-only"/>
<id name="rightsId" type="integer">
<column name="rights_id" />
<generator class="native">
<param name="sequence">rights_rights_id_seq</param>
</generator>
</id>
<property name="code" type="string">
<column name="code" length="50" not-null="true" />
</property>
<property name="descriptionKey" type="integer">
<column name="description_key" />
</property>
<set name="refRolesRightses" inverse="true">
<key>
<column name="rights_id" />
</key>
<one-to-many class="de.xcom.ticketsystem.pojo.RefRolesRights" />
</set>
</class>
</hibernate-mapping>

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 5:19 pm 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
so I have to include a hibernate version > 3.0.5 in Order to run the tools

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 4:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you just need to use the hibernate that comes with the tools....

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 4:01 pm 
Newbie

Joined: Sat Mar 04, 2006 11:28 am
Posts: 13
Location: Portugal
Can't vote either! :-(

But... after suferring with template editing and the so called "velocity error messages", and after reading your...

http://blog.hibernate.org/cgi-bin/blosx ... ocity.html

I say... yes please! Go go FreeMarker! ;-)

_________________
Pedro Viegas


Top
 Profile  
 
 Post subject: FreeMarker is the way to go
PostPosted: Tue Oct 31, 2006 1:45 pm 
Newbie

Joined: Thu May 06, 2004 3:08 pm
Posts: 3
Location: Portland, OR
I have been using Velocity. But for the current web app project I switch to FreeMarker. It is much in design, template language. I am going to check out the source of Hibernate Tool to see how much work it will be to convert it from veclocity.

It seems that hibernate.reveng.xml does not take the <cache/> to generate the hbm.xml files. So I have to post process some of the nicely generated hbm.xml files after Hibernate tool.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 01, 2006 11:11 am 
Newbie

Joined: Sat Mar 04, 2006 11:28 am
Posts: 13
Location: Portugal
Too late!
It has allready been done. :-D
Download the most recent Hibernate tools and it should be there.

Regards,

_________________
Pedro Viegas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 02, 2006 9:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hhognat, yes freemarker is already in hibernate tools (been for a while now).

regarding your cache issue then submit a patch or a ltest a bug report to jira about it. thanks.

_________________
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.  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

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.