-->
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.  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Hibernate Tools problems with MySQL.
PostPosted: Fri Jul 18, 2008 11:00 am 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
I am having a problem with hibernate reverse engineering code in generating mapping files and pojos using MySQL5.0. No exceptions were reported either.

The same code works well and generates pojos and hbm files in case of Derby.

Wondering if I am missing anything here or its a known issue.

Here is the code.

try {

cfg = new JDBCMetaDataConfiguration();
OverrideRepository or = new OverrideRepository();
Configuration c = cfg.configure(confFile);
or.addFile(FileUtil.toFile(revengFile));
DefaultReverseEngineeringStrategy strategy = new DefaultReverseEngineeringStrategy();
settings = new ReverseEngineeringSettings(strategy);
settings.setDefaultPackageName(helper.getPackageName());
strategy.setSettings(settings);
cfg.setReverseEngineeringStrategy(or.getReverseEngineeringStrategy(strategy));
cfg.readFromJDBC();
} catch (Exception e) {
Exceptions.printStackTrace(e);
}

// Generating POJOs
try {
if (helper.getDomainGen()) {
POJOExporter exporter = new POJOExporter(cfg, outputDir);
exporter.getProperties().setProperty("jdk", new Boolean(helper.getJavaSyntax()).toString());
exporter.getProperties().setProperty("ejb3", new Boolean(helper.getEjbAnnotation()).toString());
exporter.start();
}
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}

// Generating Mappings
try {
if (helper.getHbmGen()) {
HibernateMappingExporter exporter = new HibernateMappingExporter(cfg, outputDir);
exporter.start();
}
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}



I appreciate your help.

Thanks,
Gowri


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 20, 2008 2:56 am 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 1:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
looks very weird - looks like the associations is not properly build up (the associated class is missing, but it knows there is a collection)

Have you tried doing it from ant or eclipse ? Does it fail there too?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 1:35 pm 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
I have tried the same with eclipse (with the same sakila db) and there is no problem there. I was able to generate pojos and mappings without any problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 1:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ok, then im not sure what else i can do.

What netbeans supports are you using ? (i'm asking since we haven't done any netbeans support for hibernate tools ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 1:45 pm 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
What netbeans supports are you using ?

I didn't get you here. Can you be more specific ?

(i'm asking since we haven't done any netbeans support for hibernate tools ;)


Hmm. I thought hibernate-tools.jar is independent of eclipse and any IDE can use it to work with reveng features. Also what kind of support needs to be done ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 2:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Gowri wrote:
What netbeans supports are you using ?

I didn't get you here. Can you be more specific ?


Looking at your stacktrace it looks like some specific netbeans ui is being used, not just you calling out to ant from netbeans.

Quote:
(i'm asking since we haven't done any netbeans support for hibernate tools ;)


Hmm. I thought hibernate-tools.jar is independent of eclipse and any IDE can use it to work with reveng features. Also what kind of support needs to be done ?


Yes hibernate-tools.jar is independent, but if the IDE is calling it wrongly or using some random old/buggy version I can't really help...

the ones doing the IDE integration should be able to answer that - hence I asked how you were actually using it from netbeans.

About what kind of support needs to be done then look at the eclipse tools - all the ui for that is not in hibernate-tools.jar. Someone presumably done something similar for netbeans, but i don't know who - hence i'm asking you ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 2:49 pm 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
Let me be clear here.

I am a developer in Netbeans team and implementing hibernate feature for the upcoming release. So I do all the IDE integration. I got the latest jars from hibernate.org for tools and core and using them in our product. I am sure I am not using any buggy or old version since the same set of jars work well with dbs such as JavaDB and HSQLDB. The problem I am seeing is only with MySQL.

Regarding the UI part, I have a UI similar to Eclipse in generating the code. Basically the user gets to pick the database tables based on the hibernate configuration file selection. Then the user is allowed to pick the options to generate mappings and pojos (with or without annotations).

Upon finishing, I have a method (generateClasses) which calls hibernate-tools code to generate pojos and mappings through java (i.e not using ant).

I have the code attached at the very top of the question. Please take a look at it. Also I am not using any custom templates.

Regarding the stack trace, you see some exceptions from netbeans ui. But thats not the place where the problem is (I attached complete stack strace). During the mapping files generation, I am getting the exceptions.

// Generating Mappings
try {
if (helper.getHbmGen()) {
HibernateMappingExporter exporter = new HibernateMappingExporter(cfg, outputDir);
exporter.start();
}
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}

I also tried searching for eclipse hibernate sources to see how they are implementing reveng code generation. But I was not able to locate the sources. Any pointers are greatly appreciated.

And also I didn't understand what you meant by
looks like the associations is not properly build up (the associated class is missing, but it knows there is a collection)


This is a very crucial bug I need to fix and I seek your help in solving this as I have no idea about the exception I am getting.

Hope this helps.
Gowri


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 6:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Ok, good to know what you are actually trying to do ;)

You have told me that reverse engineering works fine from ant and from eclipse on the same db, but not from the code you have written - that indicates to me something must be wrong in that area. Agreed?

OR you are using some weird hibernate tools version. Which binary are you actually using ?

About "looks like the associations is not properly build up (the associated class is missing, but it knows there is a collection)" then I know that because the code would not try and call getAssociatedClass if it did not think it was a collection it is dealing with.

About how it does the code generation then the simplest is (as pointed out earlier) to see how Hibernate Ant tasks are doing it. HibernateTool and the related ExporterTasks.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 7:32 pm 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
You have told me that reverse engineering works fine from ant and from eclipse on the same db, but not from the code you have written - that indicates to me something must be wrong in that area. Agreed?

Not sure if I completely agree with you. Because the same code is working fine for JavaDB and HSQLDB. Its confusing. May be I have to agree with you in case of MySQL i.e the code I have written is not handling complex cases such as in sakila db.

Can you tell me if I am missing anything in that code ? (code is at the very top of this thread)

I am using Hibernate Tools 3.2.1.GA. I also tried replacing with Hibernate Tools jar from eclipse which is 3.2.0.GA but no luck either.

The way I am implementing reveng feature is to do the entire work of generation by making calls to Exporter classes than using ant tasks. So I looked at some test cases in Hibernate Tools and followed the same way.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2008 2:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ok im confused. Did you or did you not try to do it with the *same*database on eclipse and ant ? What was the result ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2008 3:15 am 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
I tried in Eclipse using their code generation wizard with the same db and it worked there. I never tried with ant either in Eclipse or in Netbeans.

Hope I didn't confuse you this time.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2008 3:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
So if the same thing works in eclipse something "different" must be occurring in your setup.

If you can reproduce this in a *standalone* test (not depending on netbeans ui etc.) then I can take a look and see what is going on.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2008 4:55 am 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
Max,

I wrote a simple standalone test case. I have the same problem with it too.
I didn't find any way to attach file in the forum. Thats why I sent it to your email (jboss id).

Please take a look at the test case and let me know where the problem is.

Thanks for looking into this. I really appreciate it.

Regards,
Gowri


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 24, 2008 4:06 pm 
Beginner
Beginner

Joined: Thu Apr 17, 2008 2:03 pm
Posts: 26
Max,

Wondering if you got a chance to look into the problem. Let me know in any case.

regards, Gowri


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 20 posts ]  Go to page 1, 2  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.