-->
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.  [ 10 posts ] 
Author Message
 Post subject: Middlegen-Hibernate-r5 swing problem?
PostPosted: Tue Aug 17, 2004 4:49 am 
Newbie

Joined: Tue Aug 17, 2004 4:34 am
Posts: 10
hibernate 2.1:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

oracle 9i:

Debug level Hibernate log excerpt:

When i use Middlegen-Hibernate-r5 hsql demo,it runs right.
But when i change to oracle 9i,it 's error,like this.Why?thanks help.


Buildfile: build.xml

init:

fail-if-no-xdoclet-1.2:

check-driver-present:

panic-if-driver-not-present:

middlegen:
[echo] Class path = E:\PAM\project\Middlegen-Hibernate-r5
[middlegen] - Registering plugin simple->middlegen.Plugin
[middlegen] - Registering plugin java->middlegen.javax.JavaPlugin
[middlegen] - Registering plugin plugin->middlegen.Plugin
[middlegen] - Registering plugin hibernate->middlegen.plugins.hibernate.Hibernat
ePlugin
[middlegen] Database URL:jdbc:oracle:thin:@localhost:1521:chenhan
[middlegen] No <table> elements specified. Reading all tables. This might take a
while...
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVA_GROUPITEM
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVA_GROUPBY
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVAGROUP_GROUPITEM
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
T_MENU
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
T_VERSIONS
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVA_FILTER
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
STKCLASS
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
MAT_STAT
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
PUBORG
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
STK_MONEY_SUM
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
V$LOCKEDOBJECT
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVAGROUP_GROUPBY
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
STKSTA
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVA_TABLELINK
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
MATWKF
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
V_PLANTSTATE
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
V$LOCKED_OBJECT
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
PUBNUM
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
DUPMATREQITM
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
T_RUNPARAM
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVA_RULE
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVA_TABLE
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
CLA
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVA_FIELD
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
SUPPLIERS
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVAGROUP_FIELD
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
STKITMARR
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
EVAGROUP_RULE
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
STATISTICS
[middlegen] - WARNING: The JDBC driver didn't report any primary key columns in
CONSUMPTION
[middlegen] - Validating hibernate
[middlegen] ********************************************************
[middlegen] * CTRL-Click relations to modify their cardinality *
[middlegen] * SHIFT-Click relations to modify their directionality *
[middlegen] ********************************************************
[middlegen] java.lang.NullPointerException
[middlegen] at middlegen.swing.JTablePanel.<init>(JTablePanel.java:106)
[middlegen] at middlegen.swing.JDatabasePanel.reset(JDatabasePanel.java:285)

[middlegen] at middlegen.swing.JMiddlegenFrame.setVisible(JMiddlegenFrame.ja
va:171)
[middlegen] at middlegen.MiddlegenTask.execute(MiddlegenTask.java:446)
[middlegen] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[middlegen] at org.apache.tools.ant.Task.perform(Task.java:364)
[middlegen] at org.apache.tools.ant.Target.execute(Target.java:301)
[middlegen] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[middlegen] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)

[middlegen] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[middlegen] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[middlegen] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[middlegen] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[middlegen] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

BUILD FAILED
E:\PAM\project\Middlegen-Hibernate-r5\build.xml:148: java.lang.NullPointerExcept
ion

Total time: 31 seconds


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 17, 2004 6:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Do you seriously have this many tables that don't have primary keys?

If it the case then its not the best table design around. In anycase, I assume that the JDBC driver is not working correctly (based on the assumption that you don't have this many tables without primary keys). Try upgrading your JDBC driver with a newer/better version. Oracle's early 9i JDBC drivers were buggy.


Top
 Profile  
 
 Post subject: Thanks for your help
PostPosted: Thu Aug 19, 2004 5:25 am 
Newbie

Joined: Tue Aug 17, 2004 4:34 am
Posts: 10
Thanks for your help!
Before this problem,there are another problem like this:"Wow! Synonym V$SESSION not found. How can it happen?"or"Wow! Synonym V$LOCKED_OBJECT not found. How can it happen?".Finally,I delete the two synonym,it ok.but I don't konw what bug will happen in my program.Do you think?
thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 7:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
If Middlegen is reading the data as you would expect then your fine.


Top
 Profile  
 
 Post subject: Thanks a lot
PostPosted: Thu Aug 19, 2004 12:20 pm 
Newbie

Joined: Tue Aug 17, 2004 4:34 am
Posts: 10
Thanks a lot


Top
 Profile  
 
 Post subject: Have you resovled that problem?
PostPosted: Fri Nov 04, 2005 11:42 am 
Newbie

Joined: Tue Nov 01, 2005 10:42 am
Posts: 1
I have encountered the same problem. Even I changed the lastest driver of Oracle, the problem still be there.

Please help me.

_________________
Aging!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 1:17 pm 
Newbie

Joined: Thu Oct 27, 2005 6:01 pm
Posts: 15
I have been having the same problem, which caused me to look more closely into my database schema (I am working with a legacy database that was designed long before my time.) What I discovered was that that the problem tables were not even those that simply have no primary keys - Middlegen treats all columns as one big composite key in that case. The real problem tables were those that have no primary keys, yet do have foreign keys (for some unfathomable reason Informix allows this, perhaps other DBMS's do too.) On those tables Middlegen was choking (perhaps understandably :-) and threw an exception similar to the one you are getting.

So, I guess one possible solution is to try to find all tables that are involved in relationships with other tables, but don't have primary keys (standalone tables are ok, as far as Middlegen is concerned.) Then fix those tables, either by finding the candidate keys and declaring them as primary key, or creating a surrogate key (a sequence column), or, in the worst case scenario, declare all fields as one big composite key.

However, I think Middlegen should be nice enough to at least tell us what the problem is, and list the specific tables that are causing the problem, instead of causing us to go hunting for one or two rogue tables among hundreds of others. I wonder if this is a known issue in Middlegen (David, perhaps you could shed some light on this?)

Gene


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 10:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
It is likely a Hibernate plugin bug rather than just a Middlegen core problem. The reason being the Hibernate plugin does a poor job with relationships when there is no primary key. Its default behaviour is to just generate one big composite key where its not to smart about what else it may have to deal with. The real issue is the fact its not a valid relational model - unfortuately they are quite common. I do agree better error messages would be beneficial.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 11:59 am 
Newbie

Joined: Thu Oct 27, 2005 6:01 pm
Posts: 15
I also noticed that in those tables that don't have PKs, the mapping files generated by Middlegen declare a <composite-id> that includes all columns, and one of the columns is declared as
Code:
<meta attribute="field-description" inherit="false">
    @hibernate.id
     generator-class="assigned"
</meta>


But in the generated POJO, this meta is somehow ignored, so no properties are tagged as id. As a result, XDoclet cannot process them later when it tries to generate mappings. This sounds like a bug not in the Middlegen Hibernate plugin, but in hbm2java.

Eugene


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 10:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You can supply a sample mapping document and submit it to JIRA.
BTW: Need to know what version of HBM2Java you are using etc.


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