After setting the match-catalog attribute in reveng.xml (not sure if this a must for MySQL), I started seeing exceptions while generating mapping files. There is no problem in generating pojos.
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sakila</property>
<property name="hibernate.connection.username">root</property>
</session-factory>
</hibernate-configuration>
reveng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
<table-filter exclude="false" match-catalog="sakila" match-name="address" match-schema=".*"/>
<table-filter exclude="false" match-catalog="sakila" match-name="category" match-schema=".*"/>
<table-filter exclude="false" match-catalog="sakila" match-name="city" match-schema=".*"/>
<table-filter exclude="false" match-catalog="sakila" match-name="country" match-schema=".*"/>
</hibernate-reverse-engineering>
Address.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jul 19, 2008 11:29:53 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class
name="sakilaDB.Address"
table="address"
catalog="sakila"
>
<id
name="addressId"
type="java.lang.Short"
>
<column name="address_id" />
<generator class="identity" />
</id>
<many-to-one
name="city"
class="sakilaDB.City"
fetch="select"
>
<column name="city_id" not-null="true" />
</many-to-one>
<property
name="address"
type="string"
>
<column name="address" length="50" not-null="true" />
</property>
<property
name="address2"
type="string"
>
<column name="address2" length="50" />
</property>
<property
name="district"
type="string"
>
<column name="district" length="20" not-null="true" />
</property>
<property
name="postalCode"
type="string"
>
<column name="postal_code" length="10" />
</property>
<property
name="phone"
type="string"
>
<column name="phone" length="20" not-null="true" />
</property>
<property
name="lastUpdate"
type="timestamp"
>
<column name="last_update" length="0" not-null="true" />
</property>
</class>
</hibernate-mapping>
Adress.java
package sakilaDB;
// Generated Jul 19, 2008 11:29:48 PM by Hibernate Tools 3.2.1.GA
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* Address generated by hbm2java
*/
@Entity
@Table(name="address"
,catalog="sakila"
)
public class Address implements java.io.Serializable {
private Short addressId;
private City city;
private String address;
private String address2;
private String district;
private String postalCode;
private String phone;
private Date lastUpdate;
public Address() {
}
public Address(City city, String address, String district, String phone, Date lastUpdate) {
this.city = city;
this.address = address;
this.district = district;
this.phone = phone;
this.lastUpdate = lastUpdate;
}
public Address(City city, String address, String address2, String district, String postalCode, String phone, Date lastUpdate) {
this.city = city;
this.address = address;
this.address2 = address2;
this.district = district;
this.postalCode = postalCode;
this.phone = phone;
this.lastUpdate = lastUpdate;
}
@Id @GeneratedValue(strategy=IDENTITY)
@Column(name="address_id", unique=true, nullable=false)
public Short getAddressId() {
return this.addressId;
}
public void setAddressId(Short addressId) {
this.addressId = addressId;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="city_id", nullable=false)
public City getCity() {
return this.city;
}
public void setCity(City city) {
this.city = city;
}
@Column(name="address", nullable=false, length=50)
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address = address;
}
@Column(name="address2", length=50)
public String getAddress2() {
return this.address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
@Column(name="district", nullable=false, length=20)
public String getDistrict() {
return this.district;
}
public void setDistrict(String district) {
this.district = district;
}
@Column(name="postal_code", length=10)
public String getPostalCode() {
return this.postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
@Column(name="phone", nullable=false, length=20)
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name="last_update", nullable=false, length=0)
public Date getLastUpdate() {
return this.lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
}
I selected 4 tables while creating reveng.xml. I could get all 4 pojos generated but there was only one hbm.xml got created (because this table doesn't have any relationship with other 3 tables that I selected). Other 3 failed with the following exception.
bbuild/netbeans/ide9/modules/ext/mysql-connector-java-5.1.5-bin.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/jav
aee.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/jsf
-impl.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/act
ivation.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/app
serv-tags.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/mai
l.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/app
serv-jstl.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/web
services-tools.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/web
services-rt.jar!/
INFO [org.netbeans.modules.hibernate.util.CustomClassLoader]: jar:file:/C:/glassfish/lib/app
serv-ws.jar!/
INFO [org.hibernate.cfg.Environment]: Hibernate 3.2.5
INFO [org.hibernate.cfg.Environment]: loaded properties from resource hibernate.properties:
{hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.provider_class=org.
netbeans.modules.hibernate.util.CustomJDBCConnectionProvider}
INFO [org.hibernate.cfg.Environment]: Bytecode provider name : cglib
INFO [org.hibernate.cfg.Environment]: using JDK 1.4 java.sql.Timestamp handling
INFO [org.hibernate.cfg.Configuration]: configuring from file: hibernate1.cfg.xml
INFO [org.hibernate.cfg.Configuration]: Configured SessionFactory: null
INFO [org.hibernate.cfg.reveng.OverrideRepository]: Override file: C:\Documents and Settings
\gowri\My Documents\NetBeansProjects\WebApplication26\src\java\hibernate.reveng.xml
INFO [org.hibernate.connection.ConnectionProviderFactory]: Initializing connection provider:
org.netbeans.modules.hibernate.util.CustomJDBCConnectionProvider
INFO [org.netbeans.modules.hibernate.util.CustomJDBCConnectionProvider]: Loaded JDBC driver
INFO [org.netbeans.modules.hibernate.util.CustomJDBCConnectionProvider]: Got connection.. re
turning
INFO [org.hibernate.cfg.SettingsFactory]: RDBMS: MySQL, version: 5.0.45-community-nt
INFO [org.hibernate.cfg.SettingsFactory]: JDBC driver: MySQL-AB JDBC Driver, version: mysql-
connector-java-5.1.5 ( Revision: ${svn.Revision} )
INFO [org.hibernate.dialect.Dialect]: Using dialect: org.hibernate.dialect.MySQLDialect
INFO [org.hibernate.transaction.TransactionFactoryFactory]: Using default transaction strate
gy (direct JDBC transactions)
INFO [org.hibernate.transaction.TransactionManagerLookupFactory]: No TransactionManagerLooku
p configured (in JTA environment, use of read-write or transactional second-level cache is n
ot recommended)
INFO [org.hibernate.cfg.SettingsFactory]: Automatic flush during beforeCompletion(): disable
d
INFO [org.hibernate.cfg.SettingsFactory]: Automatic session close at end of transaction: dis
abled
INFO [org.hibernate.cfg.SettingsFactory]: JDBC batch size: 15
INFO [org.hibernate.cfg.SettingsFactory]: JDBC batch updates for versioned data: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Scrollable result sets: enabled
INFO [org.hibernate.cfg.SettingsFactory]: JDBC3 getGeneratedKeys(): enabled
INFO [org.hibernate.cfg.SettingsFactory]: Connection release mode: auto
INFO [org.hibernate.cfg.SettingsFactory]: Maximum outer join fetch depth: 2
INFO [org.hibernate.cfg.SettingsFactory]: Default batch fetch size: 1
INFO [org.hibernate.cfg.SettingsFactory]: Generate SQL with comments: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Order SQL updates by primary key: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Order SQL inserts for batching: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Query translator: org.hibernate.hql.ast.ASTQueryTr
anslatorFactory
INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory]: Using ASTQueryTranslatorFactory
INFO [org.hibernate.cfg.SettingsFactory]: Query language substitutions: {}
INFO [org.hibernate.cfg.SettingsFactory]: JPA-QL strict compliance: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Second-level cache: enabled
INFO [org.hibernate.cfg.SettingsFactory]: Query cache: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Cache provider: org.hibernate.cache.NoCacheProvide
r
INFO [org.hibernate.cfg.SettingsFactory]: Optimize cache for minimal puts: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Structured second-level cache entries: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Statistics: disabled
INFO [org.hibernate.cfg.SettingsFactory]: Deleted entity synthetic identifier rollback: disa
bled
INFO [org.hibernate.cfg.SettingsFactory]: Default entity-mode: pojo
INFO [org.hibernate.cfg.SettingsFactory]: Named query checking : enabled
INFO [org.netbeans.modules.hibernate.util.CustomJDBCConnectionProvider]: Loaded JDBC driver
INFO [org.netbeans.modules.hibernate.util.CustomJDBCConnectionProvider]: Got connection.. re
turning
INFO [org.hibernate.tool.Version]: Hibernate Tools 3.2.1.GA
SEVERE [freemarker.runtime]:
Expression property.getValue().getElement().getAssociatedClass() is undefined on line 17, co
lumn 35 in hbm/set.hbm.ftl.
The problematic instruction:
----------
==> ${property.getValue().getElement().getAssociatedClass().getClassName()} [on line 17, col
umn 33 in hbm/set.hbm.ftl]
in include "${c2h.getTag(property)}.hbm.ftl" [on line 93, column 1 in hbm/persistentclass.h
bm.ftl]
in include "persistentclass.hbm.ftl" [on line 34, column 1 in hbm/hibernate-mapping.hbm.ftl
]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getAs
sociatedClass() is undefined on line 17, column 35 in hbm/set.hbm.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
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.IfBlock.accept(IfBlock.java:82)
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.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
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.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.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:255)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:6
7)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:103)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:148)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.ja
va:137)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:43)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:128)
at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporte
r.java:34)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.generateClasses(Hibe
rnateRevengWizard.java:366)
at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.instantiate(Hibernat
eRevengWizard.java:265)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(Templa
teWizard.java:1025)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:595)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:416)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.jav
a:248)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardItera
torWrapper.java:161)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1466)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1420)
at org.openide.WizardDescriptor.access$1600(WizardDescriptor.java:119)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:1987)
at org.openide.WizardDescriptor$Listener$2.run(WizardDescriptor.java:2036)
at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1395)
at org.openide.WizardDescriptor.access$1200(WizardDescriptor.java:119)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2043)
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 org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:449)
at $Proxy25.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java
:236)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:24
2)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
at java.awt.Dialog$1.run(Dialog.java:535)
at java.awt.Dialog$2.run(Dialog.java:565)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:563)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:863)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:897)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:885)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:109)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1355)
at org.openide.util.Mutex.readAccess(Mutex.java:268)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:870)
at java.awt.Component.show(Component.java:1302)
at java.awt.Component.setVisible(Component.java:1255)
at org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:502)
at org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:369)
at org.netbeans.modules.project.ui.actions.NewFile.doPerform(NewFile.java:153)
at org.netbeans.modules.project.ui.actions.NewFile.access$200(NewFile.java:80)
at org.netbeans.modules.project.ui.actions.NewFile$PopupListener.actionPerformed(New
File.java:348)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java
:1092)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:24
2)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
SEVERE [global]
Expression property.getValue().getElement().getAssociatedClass() is undefined on line 17, co
lumn 35 in hbm/set.hbm.ftl.
The problematic instruction:
----------
==> ${property.getValue().getElement().getAssociatedClass().getClassName()} [on line 17, col
umn 33 in hbm/set.hbm.ftl]
in include "${c2h.getTag(property)}.hbm.ftl" [on line 93, column 1 in hbm/persistentclass.h
bm.ftl]
in include "persistentclass.hbm.ftl" [on line 34, column 1 in hbm/hibernate-mapping.hbm.ftl
]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getAs
sociatedClass() is undefined on line 17, column 35 in hbm/set.hbm.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
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.IfBlock.accept(IfBlock.java:82)
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.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
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.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.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:255)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:6
7)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:103)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:148)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.ja
va:137)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:43)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:128)
at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporte
r.java:34)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.generateClasses(Hibe
rnateRevengWizard.java:366)
at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.instantiate(Hibernat
eRevengWizard.java:265)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(Templa
teWizard.java:1025)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:595)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:416)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.jav
a:248)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardItera
torWrapper.java:161)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1466)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1420)
at org.openide.WizardDescriptor.access$1600(WizardDescriptor.java:119)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:1987)
at org.openide.WizardDescriptor$Listener$2.run(WizardDescriptor.java:2036)
at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1395)
at org.openide.WizardDescriptor.access$1200(WizardDescriptor.java:119)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2043)
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 org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:449)
at $Proxy25.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java
:236)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:24
2)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
at java.awt.Dialog$1.run(Dialog.java:535)
at java.awt.Dialog$2.run(Dialog.java:565)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:563)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:863)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:897)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:885)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:109)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1355)
at org.openide.util.Mutex.readAccess(Mutex.java:268)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:870)
at java.awt.Component.show(Component.java:1302)
at java.awt.Component.setVisible(Component.java:1255)
at org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:502)
at org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:369)
at org.netbeans.modules.project.ui.actions.NewFile.doPerform(NewFile.java:153)
at org.netbeans.modules.project.ui.actions.NewFile.access$200(NewFile.java:80)
at org.netbeans.modules.project.ui.actions.NewFile$PopupListener.actionPerformed(New
File.java:348)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java
:1092)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:24
2)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused: org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: sakilaDB.
Country with template hbm/hibernate-mapping.hbm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:261)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:6
7)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:103)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:148)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.ja
va:137)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:43)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:128)
at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporte
r.java:34)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
[catch] at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.generateClasses(Hibe
rnateRevengWizard.java:366)
at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.instantiate(Hibernat
eRevengWizard.java:265)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(Templa
teWizard.java:1025)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:595)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:416)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.jav
a:248)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardItera
torWrapper.java:161)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1466)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1420)
at org.openide.WizardDescriptor.access$1600(WizardDescriptor.java:119)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:1987)
at org.openide.WizardDescriptor$Listener$2.run(WizardDescriptor.java:2036)
at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1395)
at org.openide.WizardDescriptor.access$1200(WizardDescriptor.java:119)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2043)
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 org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:449)
at $Proxy25.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java
:236)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:24
2)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
at java.awt.Dialog$1.run(Dialog.java:535)
at java.awt.Dialog$2.run(Dialog.java:565)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:563)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:863)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:897)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:885)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:109)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1355)
at org.openide.util.Mutex.readAccess(Mutex.java:268)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:870)
at java.awt.Component.show(Component.java:1302)
at java.awt.Component.setVisible(Component.java:1255)
at org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:502)
at org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:369)
at org.netbeans.modules.project.ui.actions.NewFile.doPerform(NewFile.java:153)
at org.netbeans.modules.project.ui.actions.NewFile.access$200(NewFile.java:80)
at org.netbeans.modules.project.ui.actions.NewFile$PopupListener.actionPerformed(New
File.java:348)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java
:1092)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:24
2)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Not sure whats going on here. I used sakila db (
http://forge.mysql.com/wiki/SakilaSampl ... e_Database)
to test it. And I am using Netbeans IDE.
If I pick only one table which doesn't have any relationship with other tables, then both pojo and mapping are generated without any problem.
Wondering how to solve this issue. Appreciate any pointers.
Thanks, G