-->
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.  [ 13 posts ] 
Author Message
 Post subject: Middlegen-Hibernate-r5: Problem generating from our database
PostPosted: Thu Aug 05, 2004 6:01 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
I am trying to use Middlegen-Hibernate-r5 to generate .hbm.xml files for all of the tables in our database schema. It's a bit bigger then the cute airline database ... :) .... around 335 tables!

It takes several minutes for the GUI to popup but it does and from what I can see in the (very busy) table graph, things look OK.

I press "Generate" and see log messages about the .hbm.xml files geing generated. This process terminates abruptly with the stacktrace shown below. Note that it seems like the tool was trying to generate a file called "Con.hbm.xml" -- however there is no table named CON in our database! There *IS* a table named CONS (note the trailing "S"). I wonder if this is a bug in the tool or perhaps I have misconfigured it?

I'm using the stock build.xml, modified only to select the oracle.xml database config file. The oracle database config file is shown at the very bottom of the post.

I'm using Oracle 9i.

Thanks!

[tail of the output]
...
[middlegen] (middlegen.FileProducer 398 ) Generating D:\John\Eval\Middlegen-Hibernate-r5\build\gen-src\com\mbasys\mars\dataAccess\hibernate\QoeArch.hbm.xml using template from jar:file:/D:/John/Eval/Middlegen-Hibernate-r5/middlegen-lib/middlegen-hibernate-plugin-2.1.jar!/middlegen/plugins/hibernate/hibernate.vm
[middlegen] (middlegen.FileProducer 398 ) Generating D:\John\Eval\Middlegen-Hibernate-r5\build\gen-src\com\mbasys\mars\dataAccess\hibernate\AccnProc.hbm.xml using template from jar:file:/D:/John/Eval/Middlegen-Hibernate-r5/middlegen-lib/middlegen-hibernate-plugin-2.1.jar!/middlegen/plugins/hibernate/hibernate.vm
[middlegen] (middlegen.FileProducer 408 ) D:\John\Eval\Middlegen-Hibernate-r5\build\gen-src\com\mbasys\mars\dataAccess\hibernate\Con.hbm.xml (The system cannot find the file specified)
[middlegen] java.io.FileNotFoundException: D:\John\Eval\Middlegen-Hibernate-r5\build\gen-src\com\mbasys\mars\dataAccess\hibernate\Con.hbm.xml (The system cannot find the file specified)
[middlegen] at java.io.FileOutputStream.open(Native Method)
[middlegen] at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
[middlegen] at java.io.FileOutputStream.<init>(FileOutputStream.java:62)
[middlegen] at java.io.FileOutputStream.<init>(FileOutputStream.java:132)
[middlegen] at java.io.FileWriter.<init>(FileWriter.java:63)
[middlegen] at middlegen.FileProducer.generate(FileProducer.java:393)
[middlegen] at middlegen.FileProducer.generateForTable(FileProducer.java:302)
[middlegen] at middlegen.Plugin.doIt(Plugin.java:602)
[middlegen] at middlegen.Plugin.generate(Plugin.java:448)
[middlegen] at middlegen.Middlegen.writeSource(Middlegen.java:411)
[middlegen] at middlegen.swing.JMiddlegenFrame$1.actionPerformed(JMiddlegenFrame.java:72)
[middlegen] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
[middlegen] at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
[middlegen] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
[middlegen] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
[middlegen] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
[middlegen] at java.awt.Component.processMouseEvent(Component.java:3715)
[middlegen] at java.awt.Component.processEvent(Component.java:3544)
[middlegen] at java.awt.Container.processEvent(Container.java:1164)
[middlegen] at java.awt.Component.dispatchEventImpl(Component.java:2593)
[middlegen] at java.awt.Container.dispatchEventImpl(Container.java:1213)
[middlegen] at java.awt.Component.dispatchEvent(Component.java:2497)
[middlegen] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
[middlegen] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
[middlegen] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
[middlegen] at java.awt.Container.dispatchEventImpl(Container.java:1200)
[middlegen] at java.awt.Window.dispatchEventImpl(Window.java:926)
[middlegen] at java.awt.Component.dispatchEvent(Component.java:2497)
[middlegen] at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
[middlegen] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
[middlegen] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
[middlegen] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[middlegen] at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
[middlegen] middlegen.MiddlegenException: D:\John\Eval\Middlegen-Hibernate-r5\build\gen-src\com\mbasys\mars\dataAccess\hibernate\Con.hbm.xml (The system cannotfind the file specified)
[middlegen] at middlegen.FileProducer.generate(FileProducer.java:409)
[middlegen] at middlegen.FileProducer.generateForTable(FileProducer.java:302)
[middlegen] at middlegen.Plugin.doIt(Plugin.java:602)
[middlegen] at middlegen.Plugin.generate(Plugin.java:448)
[middlegen] at middlegen.Middlegen.writeSource(Middlegen.java:411)
[middlegen] at middlegen.swing.JMiddlegenFrame$1.actionPerformed(JMiddlegenFrame.java:72)
[middlegen] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
[middlegen] at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
[middlegen] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
[middlegen] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
[middlegen] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
[middlegen] at java.awt.Component.processMouseEvent(Component.java:3715)
[middlegen] at java.awt.Component.processEvent(Component.java:3544)
[middlegen] at java.awt.Container.processEvent(Container.java:1164)
[middlegen] at java.awt.Component.dispatchEventImpl(Component.java:2593)
[middlegen] at java.awt.Container.dispatchEventImpl(Container.java:1213)
[middlegen] at java.awt.Component.dispatchEvent(Component.java:2497)
[middlegen] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
[middlegen] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
[middlegen] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
[middlegen] at java.awt.Container.dispatchEventImpl(Container.java:1200)
[middlegen] at java.awt.Window.dispatchEventImpl(Window.java:926)
[middlegen] at java.awt.Component.dispatchEvent(Component.java:2497)
[middlegen] at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
[middlegen] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
[middlegen] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
[middlegen] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[middlegen] at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
[middlegen] Updated preferences in D:\John\Eval\Middlegen-Hibernate-r5\src\airline-prefs.properties

[The oracle.xml file]

<!-- =================================================================== -->
<!-- ant properties/targets for oracle 8/9 -->
<!-- note: this is not a proper xml file (there is no root element) -->
<!-- it is intended to be imported from a *real* xml file -->
<!-- =================================================================== -->

<!-- please set your Oracle-SID according to your needs -->

<property environment="env"/>

<property name="database.script.file" value="${src.dir}/sql/${name}-oracle.sql"/>
<property name="database.driver.file" value="${env.ORACLE_HOME}/jdbc/lib/classes12.jar"/>
<property name="database.driver.classpath" value="${database.driver.file}"/>
<property name="database.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="database.url" value="jdbc:oracle:thin:@localhost:1521:jlwall"/>
<property name="database.userid" value="UTTJL"/>
<property name="database.password" value="UTTJL"/>
<property name="database.schema" value="UTTJL"/>
<property name="database.catalog" value=""/>

<!--property name="jboss.datasource.mapping" value="Oracle7"/-->
<!-- property name="jboss.datasource.mapping" value="Oracle8"/-->
<property name="jboss.datasource.mapping" value="Oracle9i"/>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 10:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The stack trace does not show what really is the problem. I know of people having more then 350+ tables and one 500+ (Yes the GUI is very busy). The table you refer to have been transformed since it does attempt to create singularised and plurised table names.

What deos the schema and relationships look like on that table?

Could you try it on version 2.0 (vo) [or R4] to see if it reads the tables correctly. Getting close to releasing offical 2.1 version and R5 was going to be it.

Thanks for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 06, 2004 10:05 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
Got the same problem with a table called "News" (also applies to "Roles" got to Role) which is created as New.hbm.xml. Really good to have a class called New ;). The problem occures on r4 and r5 other version I haven't used so far.
As workaround I edited the properties file inside the src folder.

regards

Olaf

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject: Also reproduced in r4
PostPosted: Fri Aug 06, 2004 12:08 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
I forgot to mention in my original post that I dropped back to r4 to see what happens and got the same result.

Here's the DDL for thae table

CREATE TABLE CONS
(
PK_CONS_ID NUMBER(10) NOT NULL,
CONS_ABBREV VARCHAR2(15) NOT NULL,
DESCR VARCHAR2(40) NULL,
PRIO NUMBER(1) NULL,
LEV1_MIN_PROC_MATCH NUMBER NULL,
LEV2_MIN_PROC_MATCH NUMBER NULL,
DIAG_REQ NUMBER(1) NULL,
AUD_USER VARCHAR2(50) NOT NULL,
AUD_REC_ID NUMBER(10) NOT NULL,
AUD_DT DATE DEFAULT sysdate NOT NULL,
B_MOD NUMBER(1) DEFAULT 0 NOT NULL
)

--
-- Non Foreign Key Constraints for Table CONS
--

ALTER TABLE CONS ADD (
PRIMARY KEY (PK_CONS_ID));

ALTER TABLE CONS ADD (
UNIQUE (CONS_ABBREV));


Other tables refer to the PK of CONS as a foreign key.

Tell me if you need more.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 08, 2004 1:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
OK I feel better (but no happy) that it occured with R4 as well. The renaming is what the tool does by default unless the <table> tag is used. The stack trace is a worry. I will try to setup a simple test and see if I can fix it.
Can you create an entry in Hibernate tools JIRA with a reference to this thread please.

Thanks for the extra information.


Top
 Profile  
 
 Post subject: Create a JIRA entry
PostPosted: Sun Aug 08, 2004 7:07 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
I created a JIRA entry, #HBI-54. I've never done this before so excuse me if I made any mistakes.

I did not find any specific "tools" JIRA database so I used the Hibernate JIRA. I hope this is correct.

Thanks.

PS From a comment yu made it sounds like if I explicitly specify <table> entries for all my tables, I could sidestep this bug and generate the hbm.xml files from my database. True?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 08, 2004 7:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The table tag allows you to include attributes to set the plural name etc so you can avoid this issue. Its worth a try. One other use has reported problems with R5 with the table tag but I have been unable to replicated at this point.


Top
 Profile  
 
 Post subject: I'll try it
PostPosted: Mon Aug 09, 2004 12:28 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
Thanks, I'll try using <table> tags and see how it goes.

On an tangent, I notice a misspelled attribute name in the <hibernate> section of the <middlegen> task, or at least I think its a typo.

<hibernate
destination="${build.gen-src.dir}"
package="com.mbasys.mars.dataAccess.hibernate"
genXDocletTags="false"
genIntergratedCompositeKeys="false"
javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
/>

The attribute "genIntergratedCompositeKeys" should not have an "r" after the "e". It should be "genIntegratedCompositeKeys".

John


Top
 Profile  
 
 Post subject: No luck using <table> tags
PostPosted: Mon Aug 09, 2004 12:57 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
Explicitly specifying table tags did not change the behavior. Still fails.

...
<table name="CNTCT_MTHD"/>
<table name="CONS"/>
<table name="CONS_DIAG"/>
...


I also tried this for grins with the same results.

...
<table name="CONS"/>
...


Top
 Profile  
 
 Post subject: oops on my last post
PostPosted: Mon Aug 09, 2004 12:58 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
In the last post, I meant to say that I also tried this with no change in the results:

<table name="CONS" singular="CONS" plural="CONS"/>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 4:10 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
You try find references file for appliaction (in src directory) and set

hibernate.tables.CONS.base-class-name=Cons


middlegen hav problem with plural

regards


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Mon Aug 09, 2004 4:36 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
As you suggested, setting the Cons table name in the properties file did the trick!!

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 8:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Glad you have solved your problem. I will fix my small spelling typo as well :-( It is an area that has been far from being a polished skill of mine for to long (to hard to fix now).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.